This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://pusher.com/tutorials/multiple-authentication-guards-laravel/#admin-model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tutorial link | |
https://youtu.be/r9HKfJFDEFE | |
Step 1:- | |
sudo apt-get install supervisor | |
Step 2:- | |
Now go to following path | |
cd /etc/supervisor/conf.d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php?rq=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Forcing HTTPS on All Traffic | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Forcing HTTPS on a Specific Domain | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^yourdomain1.com [NC] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="{{ asset('default-image-thumbnail.jpg') }}" alt="product-image" id="imageThumbnail" width="100%" height="170"> | |
// PRODUCT IMAGE PREVIEW | |
$('#product_img').on('change', function () { | |
var file = $(this).get(0).files; | |
var reader = new FileReader(); | |
reader.readAsDataURL(file[0]); | |
reader.addEventListener('load', function (e) { | |
var image = e.target.result; | |
$('#imageThumbnail').attr('src', image); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_ip_address(){ | |
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key){ | |
if (array_key_exists($key, $_SERVER) === true){ | |
foreach (explode(',', $_SERVER[$key]) as $ip){ | |
$ip = trim($ip); // just to be safe | |
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false){ | |
return $ip; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$collection = collect([ | |
[ | |
'price' => 2561, | |
'tax' => 50 | |
], | |
[ | |
'price' => 3500, | |
'tax' => 100 | |
] | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNameAttribute($value){ | |
return strtoupper($value); | |
} | |
App\Dogs::find(2)->name; // result "JOCK" | |
That's a nice way to format database records before they hit the page, although it means that name will always be formatted that way (you can use ->getOriginal('name') if you need to see it without the formatting). | |
Here's a little secret, though. Add this to your Dogs model: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Basic structure for retrying when an exception is thrown in a try/catch block. | |
* This example fails through three retries simply to illustrate the behavior. | |
*/ | |
$retries = 3; | |
for ($try = 0; $try < $retries; $try++) { | |
try { | |
throw new \Exception('bad mojo'); | |
} catch (\Exception $e) { | |
var_dump('failed ' . $try); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/43711940/laravel-collection-using-map-and-contains | |
$list = collect($list)->map(function($x){ | |
return [ | |
'Name' => $x->fname. ' ' .$x->lname, | |
'Gender' => $x->gender, | |
'Designation' => $x->designation, | |
'Experience' => $x->exp_year, | |
'Preferred Location' => $x->preferred_location, | |
'Expected Salary' => $x->expected_salary, |
NewerOlder