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
<snippet> | |
<content><![CDATA[ | |
public function ${1:relationship}() | |
{ | |
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table}); | |
} | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>belt</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title> VueJs transition for loading data - larademy.com</title> | |
</head> | |
<body> | |
<div id="app"> |
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
<div> | |
This is my whole text that I need to select by keyboard in a easy way. | |
</div> |
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
$users =DB::table('users') | |
->select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as views')) | |
->groupBy('date') | |
->get(); |
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
$users = User::where('created_at', '>=', \Carbon\Carbon::now->subMonth()) | |
->groupBy('date') | |
->orderBy('date', 'DESC') | |
->get(array( | |
DB::raw('Date(created_at) as date'), | |
DB::raw('COUNT(*) as "views"') | |
)); |
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
//its a really bad practice | |
$a = 'Go to school'; | |
$b = 'Go to Market'; | |
$c = 'Buy Items'; | |
$d = 'Finish home task'; | |
//good way to define variables |
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 | |
// here, 1 means the first month of Year | |
$monthNumber = 1; //month in number | |
//it will return the name of the month | |
$getMonthName = date('F', mktime(0, 0, 0, $monthNum, 10)); // January | |
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
<script type="text/javascript"> | |
$('#calendar-field').daterangepicker( | |
{ | |
locale: { | |
format: 'YYYY-MM-DD' | |
}, | |
..... // other properties | |
}, |
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 | |
$users = User::with('posts')->get(); | |
foreach($users as $user){ | |
$users->posts; // posts is already loaded and no additional DB query is run | |
} | |
?> |
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 | |
$users = User::has('posts')->get(); | |
// only users that have at least one post are contained in the collection | |
OlderNewer