PHP code example of inlayphp / authorization-spatie
1. Go to this page and download the library: Download inlayphp/authorization-spatie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Inlay\AuthorizationSpatie\Contracts\TeamResolver;
final class CurrentTenantResolver implements TeamResolver
{
public function resolve(Request $request): int|string|Model|null
{
return $request->attributes->get('tenant');
}
}