1. Go to this page and download the library: Download equidna/laravel-toolkit 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/ */
// In your application's service provider
$this->app->singleton(\Equidna\Toolkit\Contracts\RouteDetectorInterface::class, fn($app) =>
$app->make(App\Routing\SubdomainRouteDetector::class)
);
$this->app->singleton('equidna.responses.json_strategy', fn($app) =>
$app->make(App\Http\Responses\AuditJsonResponse::class)
);
use Equidna\Toolkit\Helpers\RouteHelper;
if (RouteHelper::isApi()) { /* ... */ }
if (RouteHelper::wantsJson()) { /* return an API-friendly payload */ }
use Equidna\Toolkit\Helpers\ResponseHelper;
// JSON for API/hook/IoT, redirect with flash for web, text for console
return ResponseHelper::success('Saved', ['id' => $model->id]);
// Custom status and headers (filtered through the allow-list for JSON)
return ResponseHelper::unprocessableEntity(
message: 'Invalid input',
errors: ['email' => ['Already taken']],
headers: ['Retry-After' => '30'],
);
use Equidna\Toolkit\Traits\Database\HasCompositePrimaryKey;
class UserRole extends Model
{
use HasCompositePrimaryKey;
public function getKeyName()
{
return ['user_id', 'role_id'];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.