PHP code example of singsys / laravel-quick

1. Go to this page and download the library: Download singsys/laravel-quick 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/ */

    

singsys / laravel-quick example snippets


$user = User::findOrFail($id);
$token = $user->createUserToken();
$user->setAttribute('token', $token);
return $this->setData(['user' => $user])
    ->response();



namespace App\Exceptions;

use Singsys\LQ\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * Render an exception into an HTTP response.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Exception               $exception
     *
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        if ($request->is('api/*')) {
            return $this->lqRender($request, $exception);
        }

        return parent::render($request, $exception);
    }
}


php artisan migrate
php artisan lq:install
php artisan vendor:publish --tag=lq-config

protected function mapApiRoutes()
{
    Route::prefix('api')
         ->middleware([\Singsys\LQ\Middleware\LqApiMiddleware::class])
         ->namespace($this->namespace . '\Api')
         ->group(base_path('routes/api.php'));
}