v2 first commit
This commit is contained in:
@ -3,9 +3,12 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Traits\Users;
|
||||
|
||||
class ApiCompany
|
||||
{
|
||||
use Users;
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@ -22,8 +25,7 @@ class ApiCompany
|
||||
}
|
||||
|
||||
// Check if user can access company
|
||||
$companies = app('Dingo\Api\Auth\Auth')->user()->companies()->pluck('id')->toArray();
|
||||
if (!in_array($company_id, $companies)) {
|
||||
if (!$this->isUserCompany($company_id)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user