PHP code example of asseco-voice / laravel-json-search

1. Go to this page and download the library: Download asseco-voice/laravel-json-search 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/ */

    

asseco-voice / laravel-json-search example snippets


public function getSomeAttribute()
{
    return 'foo';
}

Route::post('search', 'ExampleController@search');

public function search(Request $request)
{
    return SomeModel::jsonSearch($request->all())->get();
}

Route::put('search/update', 'ExampleController@search');

public function search(Request $request)
{
    $search = SomeModel::jsonSearch($request->except('update'));

    if (!$request->has('update')) {
        throw new Exception('Missing update parameters');
    }

    $search->update($request->update);

    return $search->get();
}

Route::delete('search', 'ExampleController@search');

public function search(Request $request)
{
    return SomeModel::jsonSearch($request->all())->delete();
}