0

I need to create a page in the admin menu to generate reports from other data in the database. For example: /admin/reports. I want reports to only have access to administrators.

Bryan Zavala
  • 39
  • 1
  • 4

1 Answers1

0

You should try this

Add browse_reports permission From sql

INSERT INTO `permissions` (`key`, `table_name`, `created_at`, `updated_at`, `permission_group_id`) VALUES ('browse_reports', NULL, '2018-04-18 12:00:00', '2018-04-18 12:00:00', NULL);

Give this permission to the admin

Check this permission access to the method which is called for /admin/reports

In controller

Voyager::canOrFail('browse_reports');
AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57
  • Thank you very much, that's exactly what I was looking for – Bryan Zavala Apr 18 '18 at 19:07
  • the situation is same but how can we create for the my `Route::get('/admin/journal-agent-report',[JournalAgentReportController::class, 'index']);` also in which controller i have to add the above function – Mrkhan Nov 05 '21 at 17:07