To dump out random objects console.log(JSON.stringify(obj)) if that didn’t work: console.log(“my object: %o”, obj); A straight console.log(obj) will often show
Laravel Query Builder WhereRaw Example
A query builder whereraw tutorial whereRaw($sql, array $bindings = [], $boolean = ‘and’) A couple of examples: $g = TableName::whereRaw(‘LOWER(worker_location)
Laravel Query Performance
Here’s a way to assess the performance of a query: Start tinker in the Laravel project directory php artisan tinker
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