This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

vinayindoria
vinayindoria
public $belongsTo = [
        'user_id' => ['Rainlab\User\Models\User',
            'scope' => 'FilterByGroup'
            ],
    ];
  1. Here I am trying to connect the User model to a custom curate model. I want to limit the users to a specific type i.e., of specific Group. The scope is already in place and it needs an array of group Id's but with all my trials to pass a parameter to the scope key failed. I might be something very small and I would like to know the right direction for the above problem.

  2. Also a easy way would be to write a specific scope but even writing that scope in the Rainlab User model is not the right way of doing stuff, so I tried with Profile plugin which is curated to extend controller and model functionality for User model and I have already used to connect other model but when I try to pass Profile in place of User in the above shared code I get the below mentioned error:

Type error: Too few arguments to function Illuminate\Support\ServiceProvider::__construct(), 0 passed in D:\wamp64\www......\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasRelationships.php on line 653 and exactly 1 expected

Last updated

daftspunky
daftspunky

Take a look at the October test plugin, it can be useful for learning:

https://github.com/octoberrain/test-plugin

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.