PHP code example of omarelgabry / lumen-api-oauth

1. Go to this page and download the library: Download omarelgabry/lumen-api-oauth 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/ */

    

omarelgabry / lumen-api-oauth example snippets


	public function __construct(){
		
		$this->middleware('oauth', ['except' => ['index', 'show']]);
		$this->middleware('authorize:' . __CLASS__, ['except' => ['index', 'show', 'store']]);
	}


	public function isAuthorized(Request $request){

		$resource = "posts";
		$post     = Post::find($this->getArgs($request)["post_id"]);

		return $this->authorizeUser($request, $resource, $post);
	}

		php artisan migrate --seed
	
app/Http/routes.php
app/Providers/AuthServiceProvider.php
app/routes.php