-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API to add cards to the dashboard from a plugin
- Loading branch information
1 parent
78e14a2
commit fdf7f65
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Azuriom\Extensions\Plugin; | ||
|
||
use Illuminate\Support\Arr; | ||
use Illuminate\View\View; | ||
|
||
abstract class AdminDashboardCardComposer | ||
{ | ||
/** | ||
* Get the cards to add to the admin dashboard. | ||
* Each card should contains: | ||
* - 'color' : A Bootstrap color (e.g: success) | ||
* - 'icon' : A FontAwesome 5 icon (e.g: fas fa-rocket) | ||
* - 'name' : The name of the card | ||
* - 'value' : The value of the card | ||
* | ||
* @return array | ||
*/ | ||
abstract public function getCards(); | ||
|
||
/** | ||
* Bind data to the view. | ||
* | ||
* @param View $view | ||
* @return void | ||
*/ | ||
public function compose(View $view) | ||
{ | ||
$cards = Arr::get($view, 'cards', []); | ||
|
||
$view->with('cards', $this->getCards() + $cards); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters