Reputation: 359
I have an AdminController
which loads all the views, although I will need to pass in information into that view.
Example Users Tab - View total users, new users, viewing the users profile etc, editing them.
Is it better to create a new controller to do those methods in and then in the AdminController
to call $users = new UsersController;
?
I am trying to find the most efficient way OOP.
Upvotes: 1
Views: 155
Reputation: 1899
Yes, you need to create a UsersController. It sounds like a resource controller would be your best option.
Do php artisan make:controller UsersController --resource
and then add this to your routes file:
Route::resource('admin/users', 'UsersController')->middleware('auth');
Upvotes: 1