1. Go to this page and download the library: Download ibnudirsan/handler-sanctum 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/ */
/**
* Method yang dapat digunakan
*/
return ResponseJson::cretae($result);
return ResponseJson::read($result);
return ResponseJson::show($result);
return ResponseJson::update();
return ResponseJson::delete();
// App/Http/Controllers/usersController.php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Ibnudirsan\LaraHandlerSanctum\Halper\ResponseJson;
class usersController extends Controller
{
public function getUser($id)
{
$result = User::where('id',$id)->first();
return ResponseJson::read($result);
}
}