I am a novice in Laravel, I have made a simple hello program in Laravel and I want to use a cookie in my program. How do I create and delete a cookie in Laravel? Also, how do I set session in Laravel? Answer Set cookie: Cookie::queue(Cookie::make(‘cookieName’, ‘value’, $minutes)); Get cookie: $value = $request->cookie(‘cookieName’); or $value = Cookie::get(‘cookieName’); Forget/remove cookie:
Tag: laravel-5
How to print table data in Laravel 5.6?
in My Larvel 5.6 app I am working with mysql db. and in my application I have vehicle table with following columns, vehicles, and I am going to group all models of the table and printing here as My controller, my printing blade file is this, it is printing well as now I need print in-front of model name there
How to get the value of specific index inside an array column using mysql?
I am passing index id to the function. Is there a way to do it like this? Answer Use the arrow operator (MySQL-only): Or its alias JSON_EXTRACT() (MySQL & MariaDB):
Session flash message timeout in Laravel
I have created flash message in Laravel page using controller. It’s showing well but need to add timeout in flash message In view page Answer Try this using Jquery function
Block a resource for only one user in laravel PHP AJAX and redirect the other to a readonly form
I create an application with laravel 5.5. I use so PHP AJAX and MySQL. I have a problem. An user connect with his account on the application and when he will click on an element (for example a contact …
How can I show subcategories in categories?
Here’s the code: I will like to display parent category and its children under it. Something like this: Category Sub 1 Sub 2 Category – Sub 1 – Sub 2 I want to show data like see demo Database Structure. Both categories and subcategories are in same table. Database Answer Try this: Output:
Laravel UUID’s and their uniqueness?
I have two tables, one for lists and another that stores a history of lists that were created. These lists are very temporary and they can be deleted by numerous methods so I add a reason field on the history for that. Now both have a uuid field and I can generate an actual string to store with Laravel’s helper
Laravel array_only with dot notation
Laravel has a helper that allows you to get only the keys you want like so: https://laravel.com/docs/5.6/helpers#method-array-only $array = [‘name’ => ‘Desk’, ‘price’ => 100, ‘orders’ => 10]…
How to get messages sent with the `array` mail driver?
Starting from version 5.7 Laravel suggests to use the array driver for Mail during testing: Unfortunately, the documentation tells nothing about this driver. According to the source code, the driver …
Laravel redirect()->intended() is not working in custom login controller
I have a custom login controller and its using return redirect()->intended(route(‘home’)) , as per the documentation this should send the user redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware. But for my case every time it is redirecting to home route.I am sure i have done correctly or at least