customize dashboard widgets

Laraship QuestionsCategory: Technicalcustomize dashboard widgets
matt.jones asked 5 years ago

i need to remove and add some widgets in dashboard view but i can't locate the view file of it

Attachments
1 Answers
laraship Staff answered 5 years ago

Hello,

Widgets are attached dynamically using a filter called dashboard_content

for example regarding the screenshot you attached, its hooked by eCommerce Service Provider

        \Filters::add_filter('dashboard_content', [Ecommerce::class, 'dashboard_content'], 8);

which will call this function

    /**

* @param $dashboard_content

* @return string

* @throws \Throwable

*/

public function dashboard_content($dashboard_content, $active_tab)

{

if (user()->hasRole('superuser')) {

$dashboard_content .= view('Ecommerce::dashboard.superuser')->with(compact('active_tab'))->render();

} else {

$dashboard_content .= view('Ecommerce::dashboard.user')->with(compact('active_tab'))->render();

}

return $dashboard_content;

}