Get expert guidance in a few days with a Laravel code review

Append Artisan Tables with Laravel 6.15.0

Published on by

Append Artisan Tables with Laravel 6.15.0 image

Never Miss a Laravel Release 🚀

Sign up and get an email with each new Laravel release

The Laravel team released v6.15.0 this week with support for appending tables in artisan commands, a validated authorization event, and a handler method you can override to customize HTTP exception views:

Validated Auth Event

A new validated auth even fires after the user is retrieved from the user provider and validated but before the Login event. Here’s the test verifying that Validated event was dispatched during an auth attempt:

use Illuminate\Auth\Events\Validated;
 
Event::assertDispatched(Validated::class, function ($event) {
$this->assertSame('web', $event->guard);
$this->assertEquals(1, $event->user->id);
 
return true;
});

Blueprint Supports Grammar Macros

Hafez Divandari contributed the ability for Blueprint to support Grammar macros when building raw SQL statements in the toSql() method. Grammar macros enable you to customize existing grammars.

I don’t have a good example, but here’s the updated condition in Blueprint::toSql() that will consider macros from grammar:

if (method_exists($grammar, $method) || $grammar::hasMacro($method)) {
if (!is_null($sql = $grammar->$method($this, $command, $connection))) {
$statements = array_merge($statements, (array) $sql);
}
}

Custom Exception Views

Maarten Buis contributed a “getHttpExceptionView()” method to the base exceptions Handler class. If you need some custom logic around getting the view used to render exceptions, you can override this method in the application Handler child class.

Here’s the framework’s handler implementation:

/**
* Get the view used to render HTTP exceptions.
*
* @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e
* @return string
*/
protected function getHttpExceptionView(HttpExceptionInterface $e)
{
return "errors::{$e->getStatusCode()}";
}

Append Rows to an Artisan Table

You can append rows to tables in artisan commands using the appendRow method:

public function handle()
{
$table = $this->table(
['Column', 'Another column'],
[]
);
 
$table->appendRow(['Value', 'Another Value']);
$table->appendRow(['Value', 'Another Value']);
}

You can see the full list of new features and updates below and the whole diff between 6.14.0 and 6.15.0 on GitHub. The full release notes for Laravel 6.0 are available in the GitHub v6 changelog:

v6.15.0

Added

  • Added Illuminate\Auth\Events\Validated event (#31357, 7ddac28)
  • Make Blueprint support Grammar’s macro (#31365)
  • Added Macroable trait to Illuminate\Console\Scheduling\Schedule class (#31354)
  • Added support dispatchAfterResponse in BusFake (#31418, e59597f)
  • Added Illuminate\Foundation\Exceptions\Handler::getHttpExceptionView() (#31420)
  • Allowed appending of rows to Artisan tables (#31426)

Fixed

  • Fixed locks for sqlsrv queue (5868066)
  • Fixed Illuminate\Events\Dispatcher::hasListeners() (#31403, c80302e)
  • Fixed testing with unencrypted cookies (#31390)

Changed

  • Allowed multiple paths to be passed to migrate fresh and migrate refresh commands (#31381)
  • Split Console InteractsWithIO to external trait (#31376)
  • Added sms link as valid URL in UrlGenerator::isValid() method (#31382)
  • Upgrade CommonMark and use the bundled table extension (#31411)
  • Ensure Application::$terminatingCallbacks are reset on Application::flush() (#31413)
  • Remove serializer option in PhpRedisConnector::createClient() (#31417)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Bacancy

Outsource a dedicated Laravel developer for $3,200/month. With over a decade of experience in Laravel development, we deliver fast, high-quality, and cost-effective solutions at affordable rates.

Visit Bacancy
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
A new beta of Laravel Wayfinder just dropped image

A new beta of Laravel Wayfinder just dropped

Read article
Ben Bjurstrom: Laravel is the best Vibecoding stack for 2026 image

Ben Bjurstrom: Laravel is the best Vibecoding stack for 2026

Read article
Laravel Altitude - Opinionated Claude Code agents and commands for TALL stack development image

Laravel Altitude - Opinionated Claude Code agents and commands for TALL stack development

Read article
JSON:API Resource in Laravel 12.45 image

JSON:API Resource in Laravel 12.45

Read article
Caching With MongoDB for Faster Laravel Apps image

Caching With MongoDB for Faster Laravel Apps

Read article
Laravel 12.44 Adds HTTP Client afterResponse() Callbacks image

Laravel 12.44 Adds HTTP Client afterResponse() Callbacks

Read article