Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| AuthorizesClientAccess | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| commercialOwnsClient | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\Concerns; |
| 4 | |
| 5 | use Illuminate\Support\Facades\DB; |
| 6 | |
| 7 | trait AuthorizesClientAccess |
| 8 | { |
| 9 | use ChecksRole; |
| 10 | |
| 11 | protected function commercialOwnsClient(string $clientId): bool |
| 12 | { |
| 13 | $userId = request()->header('backend-user-id'); |
| 14 | |
| 15 | return DB::table('tbl_client_commercial') |
| 16 | ->where('client_id', $clientId) |
| 17 | ->where('user_id', $userId) |
| 18 | ->exists(); |
| 19 | } |
| 20 | } |