Skip to content

Tag: laravel-5

Custom pagination view in Laravel 5

Laravel 4.2 has the option to specify a custom view in app/config/view.php such as: This is gone in Laravel 5 at least regarding view.php. Is there a way to replicate this behavior in Laravel 5? Answer Whereas in Laravel 4.2 I would use: In Laravel 5 you can replicate the above with the following: Now in the …

Laravel 5 – Method injection

How method injection works in Laravel 5(I mean implementation), can I inject parameters in custom method, not just in controller actions? Answer 1) Read this articles to know more about method injection in laravel 5 http://mattstauffer.co/blog/laravel-5.0-method-injection https://laracasts.com/series/whats-ne…

Laravel 5 how to get route action name?

I’m trying to get the current route action, but I’m not sure how to go about it. In Laravel 4 I was using Route::currentRouteAction() but now it’s a bit different. I’m trying to do Route::getActionName() in my controller but it keeps giving me method not found. Answer In Laravel 5 you …

Laravel Check If Related Model Exists

I have an Eloquent model which has a related model: When I create the model, it does not necessarily have a related model. When I update it, I might add an option, or not. So I need to check if the related model exists, to either update it, or create it, respectively: Where <related_model_exists> is the…