You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Somewhere down the line Laravel supported Form Request Validation where you create a Request subclass and implement an authorise method. That seems to me to be the perfect place to check an API key. https://laravel.com/docs/master/validation#form-request-validation
Then a controller could look like this, not no subclass of APIGuardController
class PostController extends Controller
{
public function store(APIGuardRequest $request){
}
}
Then you could easily choose which methods are guarded and which aren't, by simply omitting the request param. Then you wouldn't need to deal with the cumbersome apiMethods property for turning key auth off and thus would probably reduce code complexity.
Just thought I'd mention this is its the first thing that came to mind when deciding to use api-guard.
The text was updated successfully, but these errors were encountered:
Somewhere down the line Laravel supported Form Request Validation where you create a Request subclass and implement an authorise method. That seems to me to be the perfect place to check an API key.
https://laravel.com/docs/master/validation#form-request-validation
Then a controller could look like this, not no subclass of APIGuardController
Then you could easily choose which methods are guarded and which aren't, by simply omitting the request param. Then you wouldn't need to deal with the cumbersome apiMethods property for turning key auth off and thus would probably reduce code complexity.
Just thought I'd mention this is its the first thing that came to mind when deciding to use api-guard.
The text was updated successfully, but these errors were encountered: