Thoughts, etc.

Tracking the occasional random walk

laravel

JSON responses as PHP arrays in Laravel 8 tests

2021-02-10 / Leave a Comment

I’m in the process of upgrading an API code base that has been in production since Laravel 5, and continues to evolve. The bulk of the update to version 8 went smoothly, but one breaking change that I couldn’t find documented anywhere held me up for some time this afternoon. A great many of the … [Read more…]

Posted in: code Tagged: laravel

Getting a Faker instance in Laravel’s tinker environment

2018-05-03 / 3 Comments

I sometimes find that it would be useful to use  artisan tinker to play with the sorts of data that Faker will generate in a Laravel factory. Unfortunately I don’t do it often enough to always remember the correct way to do it, since the obvious  new Faker\Generator doesn’t work. So for future reference, what you need is:

1
>>> $faker = Faker\Factory::create();

 

Posted in: snippets Tagged: laravel, notes

Testing routes with Laravel-Localization

2016-03-16 / 7 Comments

I recently added the Laravel-Localization package (with Laravel 5.2) to a project I’m working on. Initial setup went smoothly, and I was impressed with how well things worked essentially out of the box. Then I tried to test my routes. I had previously made a test case that ran through all of my public routes and asserted … [Read more…]

Posted in: code Tagged: laravel

Laravel 5.1 “intermediate quickstart” notes

2015-12-16 / Leave a Comment

I just ran through Laravel’s intermediate quickstart tutorial. On the whole it was rather well put together and worked with as little or as much copying and pasting as you felt like using. Here I’m just recording a few notes for future reference about non-obvious things I encountered. Error messages for simple typos One interesting … [Read more…]

Posted in: code Tagged: laravel, notes