composer require devdr/api-crud-generatorDevDr\ApiCrudGenerator\DrCrudServiceProvider::classFYI: Please make sure the parameter should be same as your table name Ex: if the table name is user then you can use command as bellow.
This command generate Model file, Request File, Resource controller file for api and also add resource routes into api.php
php artisan crud:api-generator User'api.auth' => \DevDr\ApiCrudGenerator\Middleware\CheckAuth::class,Now you can use this 'api.auth' middleware anywhere
$user = $request->get('users');public static function findIdentityByAccessToken($token, $type = null)
{
return static::where(['auth_token' => $token])->first();
}without middleware you can use bellow function into the direct controller api action
$user = $this->_checkAuth();Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.