Skip to main content

Posts

Showing posts with the label Create Controllers with a Custom Stub in Laravel 8.36

Create Controllers with a Custom Stub in Laravel 8.36

The Laravel team released 8.36 with a custom stub option when creating controllers, a useCurrentOnUpdate method for blueprint datetime columns in MySQL, a dispatch_sync() helper function, and the latest changes in the 8.x branch: Support useCurrentOnUpdate for MySQL Datetime Columns Tim Martin contributed support for useCurrentOnUpdate for MySQL DATETIME column types: This allows using DATETIME columns for metadata like created_at and updated_at more effectively. Since TIMESTAMP columns in MySQL suffer from the Year 2038 Problem , using DATETIME columns is preferred in some applications. Here's an example from the tests: $blueprint = new Blueprint('users'); $blueprint->dateTime('foo')->useCurrentOnUpdate(); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); $this->assertSame('alter table `users` add `foo` datetime on update CURRENT_TIMESTAMP not null', $statements[0]); Queue