Latest Laravel Tips

Determining the size in megabytes of a MySQL table

Committed to the LaraBrain by: wjgilmore at December 12, 2016 6:46 pm

Calculate the size of a MySQL table using a simple query

Database

Selectively Enabling Middleware in a Laravel Lumen Unit Test

Committed to the LaraBrain by: wjgilmore at July 28, 2016 4:37 pm

It's typical to disable middleware when running tests, but what if you want to selectively enable it?

Testing

Disabling Middleware in Lumen Tests

Committed to the LaraBrain by: wjgilmore at July 11, 2016 8:36 pm

Lumen doesn't support the testing middleware trait, but there's another way to disable middleware in your tests

Testing

Localizing Faker in Laravel

Committed to the LaraBrain by: wjgilmore at July 11, 2016 6:48 pm

Faker supports a wide variety of locales, but en_GB is the default. So how can you change this in your Laravel application?

Testing

Excluding Multiple PHPUnit Groups

Committed to the LaraBrain by: wjgilmore at June 24, 2016 2:24 pm

Using groups and a PHPUnit option you can wield total control over which test suites are executed

Testing

Passing GET Parameters When Using Laravel Pagination

Committed to the LaraBrain by: wjgilmore at June 23, 2016 7:22 pm

To paginate search results you'll need to tell Laravel to pass the search parameters from one page to the next

Blade Eloquent Views

Determining if a Laravel User is Authenticated

Committed to the LaraBrain by: wjgilmore at May 10, 2016 4:25 pm

Laravel application users often must be authenticated before access is granted to certain site features

Authentication Forms Views

Forcing Laravel to Treat a Database Column as a Date

Committed to the LaraBrain by: wjgilmore at March 9, 2016 2:43 pm

Laravel will automatically treat user-defined timestamps as dates however there is an easy fix

Database Eloquent Views

Retrieving Laravel's Current Database Name

Committed to the LaraBrain by: wjgilmore at March 8, 2016 4:16 pm

When troubleshooting database connectivity it can be useful to log the current database name

Database Debugging Testing

Dynamically Generating a Month Form Field and Setting a Default Value

Committed to the LaraBrain by: wjgilmore at March 7, 2016 2:46 pm

Small visual cues can help users complete a form faster and with fewer errors

Forms

Installing a Composer Package Only in Development Environment

Committed to the LaraBrain by: wjgilmore at February 14, 2016 8:53 pm

There are plenty of useful PHP packages, however you'll often only want to install theml in your development environment

Debugging Deployment Testing

Passing Arguments to Laravel's Artisan::call method

Committed to the LaraBrain by: wjgilmore at February 8, 2016 4:41 pm

Pass arguments to Artisan::call is possible but the proper approach is not obvious

Testing

Changing a Laravel Model's Default Table Name

Committed to the LaraBrain by: wjgilmore at January 26, 2016 4:58 pm

Somtimes you need to override Laravel's default table naming convention. This short post shows you how.

Database Eloquent

Converting a Laravel Collection to an Array

Committed to the LaraBrain by: wjgilmore at January 25, 2016 4:22 pm

This tip shows you how to convert a Laravel collection into an array

Database Eloquent Forms

Return to previous page

Committed to the LaraBrain by: Snapey at January 3, 2016 1:27 am

Easily return to the previous page by a simple URL helper

Blade Routing Views

Sanitizing Form Data Before Validating in a Laravel 5 Form Request

Committed to the LaraBrain by: wjgilmore at December 8, 2015 7:22 pm

Sometimes submitted data requires a bit of additional work prior to validation

Forms

Executing Artisan's serve Command Using a Specific Port

Committed to the LaraBrain by: wjgilmore at November 23, 2015 11:41 am

To access your Laravel development site on an internal network you'll need to specify a port

Testing

Different solutions for ensuring a Laravel user is authenticated

Committed to the LaraBrain by: wjgilmore at November 13, 2015 2:09 pm

Laravel offers a number of different solutions for determining whether a user is authenticated

Authentication Forms

Selectively Disabling the Laravel Debugbar

Committed to the LaraBrain by: wjgilmore at November 12, 2015 4:32 pm

The Laravel Debugbar is an indispensable tool, but sometimes you need to disable it for certain controllers

Debugging

Debugging Laravel migrations using verbose output

Committed to the LaraBrain by: wjgilmore at November 12, 2015 3:33 pm

By increasing verbosity you can easily identify a broken migration

Database Debugging