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
| <ul class="nav navbar-nav pull-right"> | |
| <li class="{{ Request::is('/') ? 'active' : '' }}"> | |
| <a href="{{ url('/') }}">Home</a> | |
| </li> | |
| <li class="{{ Request::is('about') ? 'active' : '' }}"> | |
| <a href="{{ url('/about') }}">About Us</a> | |
| </li> | |
| <li class="{{ Request::is('whyus') ? 'active' : '' }}"> | |
| <a href="{{ url('/whyus') }}">Why Us</a> | |
| </li> |
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
| Just run this below command line in terminal and come back to PhpMyAdmin. Now it works fine :) | |
| sudo sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php |
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
| Reference: | |
| https://medium.com/@alexrenoki/pushing-laravel-further-best-tips-good-practices-for-laravel-5-7-ac97305b8cac | |
| 1. Simple Scope | |
| class Post extends Model | |
| { | |
| public function scopeActive($query) | |
| { |
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
| <fieldset class="form-legend"> | |
| <legend class="form-legend">My Legend</legend> | |
| </fieldset> | |
| /* STYLESHEET */ | |
| fieldset.form-legend { | |
| border: 1px solid #b4c4d8 !important; | |
| padding: 0 1.4em 1.4em 1.4em !important; | |
| margin: 0 0 1.5em 0 !important; |
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> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> | |
| </head> | |
| <body> |
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
| DB::transaction(function () { | |
| DB::table('users')->update(['name' => 'xxx']); | |
| DB::table('posts')->delete(); | |
| }); |
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
| In Ajax Code | |
| ----------------------------------------- | |
| // GET SUB PROJECT | |
| $('#project_id').on('change', function () { | |
| var project_id = $(this).val(); | |
| $.ajaxSetup({ | |
| headers: { | |
| 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
| } | |
| }); |
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
| // Listing Page | |
| <?php | |
| $conn = mysqli_connect('localhost','root','','learning'); | |
| $query = mysqli_query($conn, "SELECT * FROM users ORDER BY name ASC"); | |
| ?> | |
| <html> | |
| <head> | |
| <title>Export data</title> |
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
| /** | |
| * Using without function call means to get relationship values | |
| */ | |
| // RIGHT | |
| // When you want to access the relationship values, use without function call | |
| User::find(1)->role->name; | |
| // Calling methods for shorthand checks | |
| // Assuming `isAdmin() = return $this->name === 'admin'` | |
| User::find(1)->role->isAdmin(); |
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
| // CONTROLLER | |
| class UserController extends Controller | |
| { | |
| public function index() | |
| { | |
| $users = User::orderBy('created_at')->get()->groupBy(function($item) { | |
| return $item->created_at->format('Y-m-d'); | |
| }); |