1. Go to this page and download the library: Download osi/auth-api 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\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Laravel\Sanctum\HasApiTokens;
use Osi\AuthApi\Models\AuthInterface;
class Admin extends Authenticatable implements AuthInterface
{
use HasApiTokens;
public function resourceFormat()
{
return $this;
// OR Create New Resource
// return new AuthResource($this);
}
public function findForPassport($username)
{
return $this->where('username', $username)->first();
}
public function apiLogs(): MorphMany
{
// return $this->morphMany(ApiLog::class, 'model');
}
public function apiPermissions(): MorphMany
{
// return $this->morphMany(ApiPermission::class, 'model');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.