Initial reseller domain report, enable editing domain service details
This commit is contained in:
21
app/Traits/ScopeServiceUserAuthorised.php
Normal file
21
app/Traits/ScopeServiceUserAuthorised.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Add a ScopeAuthorised to an Eloquent Model
|
||||
* This will help limit the scope of accounts that a user can see.
|
||||
*/
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
trait ScopeServiceUserAuthorised
|
||||
{
|
||||
/**
|
||||
* Only query records that the user is authorised to see
|
||||
*/
|
||||
public function scopeServiceUserAuthorised($query,User $uo)
|
||||
{
|
||||
return $query
|
||||
->whereIN('ab_service.account_id',$uo->all_accounts()->pluck('id')->unique()->toArray());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user