PHP code example of josegus / laravel-dash

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

    

josegus / laravel-dash example snippets




Route::get('api/users', 'UsersController@index')->name('api.users.index');


    
namespace App\DataTables;

use App\Users;
use Dash\DataTables\Datatable;

class UsersTable extends Datatable
{
    public function query()
    {
        return Users::query();
    }
}



namespace App\Http\Controllers\Api;

use App\DataTables\UsersTable;

class UsersController
{
    public function index()
    {
        return UsersTable::generate(); 
    }
}

public function query()
{
    return Users::query()
                ->where('status', 'active')
                ->whereHas('courses', function ($courses) {
                    $courses->where('status', 'open');
                })
                ->select(['id', 'name', 'email'])
                ->with(['posts']);
}
bash
php artisan vendor:publish --tag:laravel-dash:assets
bash
php artisan vendor:publish --tag=laravel-dash:config
bash
php artisan vendor:publish --tag=laravel-dash:views
bash
php artisan vendor:publish --tag=laravel-dash:layout-views
bash
php artisan vendor:publish --tag=laravel-dash:auth-views