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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>sayd haque video</title> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
| <script> |
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
| <?php | |
| $users = User::whereHas('posts', function($q){ | |
| $q->where('created_at', '>=', '2015-01-01 00:00:00'); | |
| })->get(); | |
| // only users that have posts from this year are returned | |
| ?> |
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
| <?php | |
| $users = User::has('posts')->get(); | |
| // only users that have at least one post are contained in the collection | |
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
| <?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 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
| <script type="text/javascript"> | |
| $('#calendar-field').daterangepicker( | |
| { | |
| locale: { | |
| format: 'YYYY-MM-DD' | |
| }, | |
| ..... // other properties | |
| }, |
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
| <?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 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
| //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 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
| $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"') | |
| )); |