PHP code example of khazhinov / laravel-lighty

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

    

khazhinov / laravel-lighty example snippets


namespace App\Exceptions;

use Khazhinov\LaravelLighty\Exceptions\ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array<int, class-string<Throwable>>
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array<int, string>
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];
}


#/api/v1.0/testEntities
Route::group([
    "namespace" => "TestEntity",
    "prefix" => "/testEntities",
    "as" => "test_entities.",
], static function () {
    Route::get("/validations/{method?}", "TestEntityCRUDController@getValidations")->name("validations");

    Route::get("/", "TestEntityCRUDController@index")->name("index");
    Route::post("/search", "TestEntityCRUDController@index")->name("search");
    Route::post("/setPosition", "TestEntityCRUDController@setPosition")->name("set-position");

    Route::post("/", "TestEntityCRUDController@store")->name("store");
    Route::delete("/", "TestEntityCRUDController@bulkDestroy")->name("bulk-destroy");

    #/api/v1.0/testEntities/:key
    Route::group([
        "prefix" => "/{key}",
    ], static function () {
        Route::get("/", "TestEntityCRUDController@show")->name("show");
        Route::put("/", "TestEntityCRUDController@update")->name("update");
        Route::delete("/", "TestEntityCRUDController@destroy")->name("destroy");
    });
});



use Illuminate\Support\Facades\Route;


# /api/v1.0/
Route::group(["namespace" => "App\Http\Controllers\Api\V1_0", "prefix" => "/v1.0", "as" => "api.v1_0"], static function () {
    #/api/v1.0/testEntities
    Route::group([
        "namespace" => "TestEntity",
        "prefix" => "/testEntities",
        "as" => "test_entities.",
    ], static function () {
        Route::get("/validations/{method?}", "TestEntityCRUDController@getValidations")->name("validations");

        Route::get("/", "TestEntityCRUDController@index")->name("index");
        Route::post("/search", "TestEntityCRUDController@index")->name("search");
        Route::post("/setPosition", "TestEntityCRUDController@setPosition")->name("set-position");

        Route::post("/", "TestEntityCRUDController@store")->name("store");
        Route::delete("/", "TestEntityCRUDController@bulkDestroy")->name("bulk-destroy");

        #/api/v1.0/testEntities/:key
        Route::group([
            "prefix" => "/{key}",
        ], static function () {
            Route::get("/", "TestEntityCRUDController@show")->name("show");
            Route::put("/", "TestEntityCRUDController@update")->name("update");
            Route::delete("/", "TestEntityCRUDController@destroy")->name("destroy");
        });
    });
});
bash
php artisan vendor:publish --provider="Khazhinov\LaravelLighty\LaravelLightyServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Khazhinov\LaravelLighty\LaravelLightyServiceProvider" --tag="views"
bash
php artisan lighty:generator TestEntity v1.0 --migration