Laravel’s Request class provides many methods for reading the HTTP request of the current request. One of these function is named ajax(). Using this function We can check the request type under controllers or route filters..etc. […]
How to remove specific element from an array in PHP?
Here is the simple quick post about removing specific element from an array using php.In this example we are going to use array_search() function , it will return match value key ,based on returned key by using unset() […]
Creating and Retrieving Cookie in Laravel ?
For Creating cookies in Laravel we use Cookie::make() method and for reading cookie we use Cookie::get() method. Basically the Cookie::get() method is a wrapper over Request::cookie(). All cookies created by the Laravel […]
Define Variable In Blade Templates Laravel?
Blade did not provided a way to define variables.But you can extend blade by using extend method as shown below
1 2 3 |
Blade::extend(function($value) { return preg_replace('/\@var(.+)/', '<?php ${1}; ?>', $value); }); |
1 |
@var $variableName = "variableValue" |
Using Query Scopes in Laravel?
Today i would like to write about Laravel Eloquent’s Query Scopes , Query scopes are allow us to re-use query logic by allowing us to encapsulate database logic inside model class methods. For example if you have […]
How to use array_map() with class method?
Using array_map() function is pretty simple in procedural style coding in PHP, while coding in object oriented fashion is also easy but bit tricky. So here i would like to share simple example on using class method as […]
Redirect back to original destination after login in Laravel
In this post i want to show you some basic tips for redirecting user back to original destination path or some defined path with simple steps. If you want to send user to previous original destination URL after login.Laravel […]
PHP array_map for multidimensional arrays
Array map is one of the interesting PHP’s array function. But it will not work with multidimensional arrays as expected.So in this post, I would like to share a simple alternative technique for array_map(). Our function […]