Just another November 11

Coding. AI-ng solutions. Reading concepts. *The loop. *

We sometimes stumble on problems that we’ve already encountered before but cared to little to remember the concept or solution.

Just another day as a wip programmer here. Here’s what I noted today.

  1. in php, function type: removeFiles() : string
    you can use ?string which means nullable return, so its either string or null
  2. in php, to throw exceptions that can be handle by catch(): use throw new Exception("the error")
  3. PHP falsy values that can be catch by !$variableName: null, false, 0, '0', '', []
  4. in Laravel, return self::where('order_code', $orderCode)->get() this is an Eloquent query: returns a collection.
  5. in Laravel, if you manually add models and controllers – you need to run composer dump-autoload php artisan optimize:clear
  6. in Laravel data validation, to check for uniqueness use this: unique:table,column,except_id | unique:tblSample,name,' . $request->id
  7. in tailwind CSS, element auto fill the available space use: grid-cols-[repeat(auto-fit,minmax(200px,1fr))]
  8. in HTML, to disable tab stop for specific elements add: tabIndex={-1}

Disclaimer: These are concepts I noted for myself; the grammar isn’t polished – just for me to remember the things.

Similar Posts