14 Quick Laravel Tips in 9 Minutes

  • You can run PHP Artis on Migrate with --pretend to see SQL queries without executing them.
  • Ash Allen uses pest architecture tests in his application to check for DD and dumps in the code.
  • You can create blade error pages with specific HTTP status codes.
  • Instead of using 'if o user' or 'if o check', you can use blade directives like 'o' and 'guest'.
  • You can use 'for else' and 'empty' to make your code shorter.
  • You can use five HTML attributes for conditions in your button.
  • You can use 'gate allow if' or 'gate authorize' to make your code shorter.
  • You can change mail driver to log in EnV file to check the email text in larl log.
  • Order your validation rules so anything triggering the database comes at the end.
  • You can use 'route view' to attach a blade view to a route without creating a controller.
  • You can clone queries to use the same base query multiple times.
  • You can group multiple resource controllers together using 'route resources'.
  • The opposite rule of 'required' in laral validation rules is 'nullable'.
  • You can group the same controller methods using 'route controller group'.

via 14 Quick Laravel Tips in 9 Minutes