Here’s a way to assess the performance of a query: Start tinker in the Laravel project directory php artisan tinker
Author: Yvonne Lu
Laravel Eloquent Collection Tips
Adding a column with constant value to existing collection: $existing_col->map(function ($col) { $col[‘url’] = ‘http://your.url/here’; return $col; }); To add
Common URL Fillter
ASCII encoding Reference: Your browser will encode input, according to the character-set used in your page. The default character-set in
Fake Data Sites
Generate fake user data https://api.randomuser.me Example access code: fetch(“https://api.randomuser.me/?nat=US&result=1”) .then(res=>res.json()) .then(json=>json.results) .then(console.log) .catch(console.error); Lorem Ipsum Generator Fake file generator
Laravel Migration
Note: when creating a table with automatically increasing id, for example: $table->increments(‘id’); The type created in a Mysql table is
PHPStorm Quick Keys
Note: I don’t think letters are case sensitive Show class methods- CNTRL+F12 Code settings CNTRL+ALT+S (can set to psr-12 style)
MYSQLI on PHPStorm Build In Web Server
PHPStorm has a build-in web server running at default port 63342. It works fine in general browser files such as
PHP Anonymous Function
$functions = [ ‘function1’ => function ($echo) { echo $echo; } ]; or function do_echo($echo) { echo $echo; } $functions
Postman pre-request script to fix nested json
This will expand json from the example data file into the body of a Postman HTTP request using collection runner.
Postman Notes
Examples Change Request Body Dynamically Set variables in scripts Update request body in pre-request script Run exported postman collection three