PHP code example of originalmind / apiauth

1. Go to this page and download the library: Download originalmind/apiauth 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/ */

    

originalmind / apiauth example snippets




class MyController extends \BaseController {

	public function __construct() {
		// OAuth token checking - from an OAuth package
		$this->beforeFilter('oauth:admin', array('only' => array('index', 'destroy')));
		$this->beforeFilter('oauth:enduser', array('only' => array('show', 'update')));

		// Token owner checking - from this package
		$this->beforeFilter('apiauthuserowner:mymodel', array('only' => array('show', 'update')));
	}