Dash Last updated: 2022-10-04
In this part, you will know that you are able to create objects according to your needs comfortably without the need for many settings in the normal way in Laravel.
Here you can use ready-made cards with a customized shape, symbols , and colors that you will like and prefer. In addtion to the possibility of merging special files through blade files
Let's take a look at the file app/Dash/Dashboard/Help.php
<?php
namespace App\Dash\Dashboard;
use Dash\Extras\Inputs\Card;
use Dash\Resource;
use \App\Models\User;
class Help extends Resource {
/**
* add your card here by Card , HTML Class
* or by view instnance render blade file
* @return array
*/
public static function cards() {
return [
Card::small()
->title(function () {
return 'All Users';
})
->column(function () {
return '3';
})
->icon(function () {
return '<i class="fa fa-users"></i>';
})
->content(function () {
return User::where('account_type', 'user')->count();
})
->color(function () {
return 'success';
}) // primary,success,dark,info,
->render(),
Card::small()
->title(function () {
return 'All Admins';
})
->column(function () {
return '3';
})
->icon(function () {
return '<i class="fa fa-users"></i>';
})
->content(function () {
return User::where('account_type', 'admin')->count();
})
->color(function () {
return 'primary';
}) // primary,success,dark,info,
->render(),
];
}
}
You will find that it is an object consisting of only one method, including to the ability to add many small cards and color them as needed, and there is a color comment with the possibility of using font awesome 6.2
Therefore, a new object can be created via this command
php artisan dash:make-dash Userscount
Userscount Dashboard generated
The file will be generated in the following path app/Dash/Dashboard/Help.php
If you look with me, you will see that the method is ready to add what you want inside it
See the code comments to understand what you should do with the two objects
use Dash\Extras\Inputs\Card;
use Dash\Extras\Inputs\HTML;
Don't forget you can use custom data through view('customFile')→render()
<?php
namespace App\Dash\Dashboard;
//use Dash\Extras\Inputs\Card;
//use Dash\Extras\Inputs\HTML;
use Dash\Resource;
class Userscount extends Resource {
/**
* add your card here by Card , HTML Class
* or by view instnance render blade file
* @return array
*/
public static function cards() {
return [
];
}
}