I think the problem you have here is that you have three distinct showTask
methods possibly doing the same thing in slightly different ways. I'd have a single showTask
method and then in the task repository a method for identifying the data to return depending upon user type.
but that's where the problem is faced: Every user type gets totally different content and views by browsing hte same route (eg /showTask). So there would be no better way than using a switch for every method
For me it still would be the same route and in repository it would do all magic and return data to controller and than controller would load view
return View::make('showTask.' . $data['userType'], $data);
Something like that.
But if you want to do something like so in routes file (witch in that case have to worry about more than one thing - breaks SOLID principle) you can do your magic and than in routes.php file
if($userType === 'admin')
{
// Admin routes
}
elseif($userType === 'guest')
{
// Here goes another routes
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community