Hello,
I want to have rows which are based on a user, so for example if I do a find I would see MY rows, if Bob did he would see HIS rows.
Now the way I have been doing this is a combo of
->where('to_user_id', Sentinel::getUser()->id);
But I am not a fan of requiring Sentinel in my Repository and it requires doing some weird construct stuff in my Repository to accommodate testing.
Basically
public function __construct(Model $model, $userid) {
if (empty($userid) { // Do something using sentinel to get the current user id
} else { // Set the user id to what is passed
}
}
So that I can use a different user id in my repository while testing.
Does anyone have any suggestions or ideas on how I could make this a bit easier to manage and test with and remove my dependency on Sentinel (or what ever user system) in my repository?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community