I would like to set a variable in the session using laravel this way but the problem is that I don’t know where to put this code, ’cause I would like to set it for one time (when the guest visite the home page or any other page)? The main idea is to use a global variable to use it
Tag: laravel
Laravel 5 – redirect to HTTPS
Working on my first Laravel 5 project and not sure where or how to place logic to force HTTPS on my app. The clincher here is that there are many domains pointing to the app and only two out of three …
laravel search multiple words separated by space
I am new to laravel query builder, I want to search multiple words entered in an input field for example if I type “jhon doe” I want to get any column that contains jhon or doe I have seen/tried solutions using php MySQL but can’t able to adapt to query builder how do I do this using query builder this
Laravel “artisan make:observer” fails
I am trying to generate a provider using Artisan as described on the documentation page [1] by running: php artisan make:observer AdServiceProvider However I get the following error: […
Difference between method calls $model->relation(); and $model->relation;
There is some basic understanding/theory here that I am missing.I don’t understand the difference between these function calls: What I am trying to accomplis here is to get a list of the distributors for a store (a many to many relationship), and they get each distributors list of beers into one giant list. I don’t know if that is the
PHPUnit: “Class ‘Eloquent’ not found” when using @dataProvider
I’m running into an issue when writing unit tests with PHPUnit using @dataProvider in a Laravel app. The error I’m receiving is: PHP Fatal error: Class ‘Eloquent’ not found in /path/to/project/app/…
Laravel 5 not finding css files
I’ve just installed a Laravel 5 project on MAMP and my pages are not finding the css files. This is the link to my css in my app.blade.php file: …
Default to Laravel File cache if redis is down
In the spirit of “chaos monkey” I’m trying to ensure that a laravel application keeps going even when the services it depends on are down. It uses a DB for primary storage, and a redis cache. What I’d like to do is have it automatically fall back to the file cache if and when redis fails. I haven’t been able
Blade: escaping text and allowing new lines
I have a user-input text displayed on one of the pages. I want to allow new lines, though. How do I display the text, so it is escaped AND allows new lines? I used nl2br() and Blade’s tripple …
Laravel, how to ignore an accessor
I have a model with a custom accessor so I get that custom attribute, But now, in one case, I need to get only some fields, without this OrderContents one. But doing it this way, it returns me the OrderContents as well.. is there a way to not get that field? Thanks! Answer There’s no way to do it in