MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
This file contains 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
/** | |
* Combines SQL and its bindings | |
* | |
* @param \Eloquent $query | |
* @return string | |
*/ | |
public static function getEloquentSqlWithBindings($query) | |
{ | |
return vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function ($binding) { | |
$binding = addslashes($binding); |
This file contains 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
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Successfully redirect all pages of domain from http to https: | |
# Note this will redirect using the 301 'permanently moved' redirect, which will help transfer your SEO rankings. | |
# To redirect using the 302 'temporarily moved' change [R=302,L] | |
This file contains 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
<?php | |
// this script would save csv file to this specified directory | |
// APPPATH is location of application folder in Codeigniter | |
$file = fopen(APPPATH . '/../upload/'.'tesaasasat.csv', 'wb'); | |
// set the column headers | |
fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5')); | |
// Sample data. This can be fetched from mysql too | |
$data = array( |
This file contains 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
// In the invalidHandler, you are passed two arguments, a jQuery.Event and the validator object. | |
// You don't need to call validate within your invalidHandler to get the validate object. | |
// Further, the validator object has a properties called errorList and errorMap, which contain the information you are looking for. | |
invalidHandler: function(e,validator) { | |
//validator.errorList contains an array of objects, where each object has properties "element" and "message". element is the actual HTML Input. | |
for (var i=0;i<validator.errorList.length;i++){ | |
console.log(validator.errorList[i]); | |
} |
This file contains 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
<?php | |
// routes/console.php | |
// quickly create an user via the command line | |
Artisan::command('user:create', function () { | |
$name = $this->ask('Name?'); | |
$email = $this->ask('Email?'); | |
$pwd = $this->ask('Password?'); | |
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted | |
\DB::table('users')->insert([ |
This file contains 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
{ | |
"states": [ | |
{ | |
"id": "1", | |
"type": "Union Territory", | |
"capital": "Mayabunder", | |
"code": "AN", | |
"name": "Andaman and Nicobar Islands", | |
"districts": [ | |
{ |
This file contains 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
<?php | |
// -- Only one caveat : The results must be ordered so that an item's parent will be processed first. | |
// -- Simulate a DB result | |
$results = array(); | |
$results[] = array('id' => 'a', 'parent' => '', 'name' => 'Johnny'); | |
$results[] = array('id' => 'b', 'parent' => 'a', 'name' => 'Bobby'); | |
$results[] = array('id' => 'c', 'parent' => 'b', 'name' => 'Marky'); | |
$results[] = array('id' => 'd', 'parent' => 'a', 'name' => 'Ricky'); |
This file contains 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
<?php | |
namespace App\Http\Controllers; | |
use DB; | |
use Config; | |
use App\Models\Course; | |
use Illuminate\Http\Request; | |
use Yajra\Datatables\Datatables; | |
use Illuminate\Support\Facades\Validator; |
This file contains 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
<?php | |
//Indexed two-dimensional array | |
$cars = array( | |
array("Honda Accord", "V6", 30000), | |
array("Toyota Camry", "LE", 24000), | |
array("Nissan Altima", "V1", 10000), | |
); | |
foreach($cars as $car){ |
NewerOlder