1. Go to this page and download the library: Download fk/laravel-utility 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/ */
fk / laravel-utility example snippets
use fk\utility\Database\Eloquent\Model;
/** @var \fk\utility\Database\Eloquent\Builder $model */
$model = Model::find(1);
$model->rawSql();
// or simply call, witch applies the __toString method
echo $model;
# auth.php
return [
'guards' => [
'api' => [
'driver' => 'easy.token',
'model' => \App\Models\User::class, // The model to retrieve user from
]
]
];
use \fk\utility\Foundation\Testing\TestCase;
class YourTest extends TestCase
{
// Write your own `CreateApplication`
// OR
// Write a `createApplication` method here
use CreateApplication;
}
namespace App\Http\Middleware;
use fk\utility\Auth\Middleware\AclAuthenticate;
class MyAuthenticate extends AclAuthenticate
{
public function authenticate(): bool
{
// Write your own authentication here
// If false returned, a `Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException` exception will be thrown
// otherwise, authentication will pass.
// Feel free to throw any kind of exceptions that fits you
}
}