PHP code example of yatilabs / api
1. Go to this page and download the library: Download yatilabs/api 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/ */
yatilabs / api example snippets
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\YourModel;
use Yatilabs\Api\BaseApi;
class YourModelController extends Controller
{
protected $baseApi;
public function __construct()
{
$this->baseApi = new BaseApi(YourModel::class);
}
public function index()
{
return $this->baseApi->index();
}
public function show($id)
{
return $this->baseApi->show($id);
}
public function store(Request $request)
{
return $this->baseApi->store($request);
}
public function update(Request $request, $id)
{
return $this->baseApi->update($request, $id);
}
public function destroy($id)
{
return $this->baseApi->destroy($id);
}
}