Download the PHP package josegus/laravel-dash without Composer
On this page you can find all versions of the php package josegus/laravel-dash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-dash
Dash: Laravel admin panel
Installation
Install the package in any laravel app executing:
Once installed, export js and css files executing:
Configuration
Config file is documented itself, export it executing:
Customizing views
Export all view files:
Export only layout views:
Export only auth views:
Build from source
You can export the resources (js and sass files) to make your own build executing:
bash php artisan vendor:publish --tag=laravel-dash:resources
The assets will now be located in the resources/dash
directory.
DataTables
The best way to use DataTables in any Laravel app is to use laravel-datatables, from Arjay Angeles (yajra). The laravel-datatables package comes with many features to include/use datatables y many ways.
I prefer to use datatables()
helper with ajax server side. Dash comes with an abstract class to help you build your
ajax response. Here is an example for an User model :
1. Create a route to data source
Since we will return a json response, api.php is a good place to put your datatable routes. You can create the path and route name as you wish, for example:
2. Create a class to build your query
Create a class that extends Dash\DataTables\Datatable
abstract class. Your class must implements query()
function
from Datatable
.
3. Create a controller method
Use the datatable class created before inside the controller:
The generate
function inside Datatable
class will take care of build the query and return a json response,
all with server side processing.
You may be wondering: why make a class just to return a simple Users::query()
?
Well, this is the most simple example, but as you can imagine, query data source can become more complex, for example:
To separate controllers and datatables data source, I prefer to have all datatables classes in App\DataTables
folder.
4. Create view
Create an html table in any blade file:
Push the datatable script to scripts
yield section:
Javascript helpers
Take a look at dataTable
and url
helpers inside this repository at resources/js/support/helpers.js.
TODO
- Add preview images
- Link to live preview
- More components: cards, dashboard templates, etc.