1. Go to this page and download the library: Download pablito/structure 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/ */
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Http\Resources\RoleResource;
use App\Contracts\RoleInterface;
class RoleController extends Controller
{
public function __construct( RoleInterface $role ){
$this->role = $role;
}
public function index(){
return RoleResource::collection( $this->role->index() );
}
}