Open ServerJunge opened 7 years ago
<?php
namespace App\Http\Middleware;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
use Illuminate\Support\Facades\Auth;
class Tenancy
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = Auth::guard()->user();
Landlord::addTenant('tenant_id', $user->tenant_id);
return $next($request);
}
}
Hi guys,
does anyone have an example for a working middleware for Laravel 5.5 where you set the tenant by the users tenant id and with auth:api routes?
Route::middleware('auth:api:web')