PHP code example of laravelha / support

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

    

laravelha / support example snippets


use Laravelha\Support\Traits\Tableable;

class Modelo extends Model {
    //
}

class Modelo extends Model {
    use Tableable;
    //
}

    /**
     * ['data' => 'columnName', 'searchable' => true, 'orderable' => true, 'linkable' => false]
     *
     * searchable and orderable is true by default
     * linkable is false by default
     *
     * @return array[]
     */
    public static function getColumns(): array
    {
        return [
            ['data' => 'id', 'linkable' => true],
            ['data' => 'title'],
            ['data' => 'subtitle'],
            ['data' => 'slug'],
            ['data' => 'content'],
        ];
    }

public function index()
{
    $columns = Model::getColumns();

    return view('models.index', compact('columns'));
}

public function data()
{
    return Model::getDatatable();
}

Route::get('/models/data', 'ModelController@data')->name('models.data');