Laravel 5.6.4 was released yesterday, with highlights including support for callbacks as custom log drivers and a Blade method for include aliases.
As of 5.6, you can define a custom logger using __invoke() as follows:
'channels' => [
'custom' => [
'driver' => 'custom',
'via' => App\Logging\CreateCustomLogger::class,
],
],
Now in Laravel 5.6.4, it’s possible to define a custom channel with a callable in the config/logging.php config file:
'channels' => [
'custom' => [
'driver' => 'custom',
'via' => [App\Logging\MyCustomLogger::class, 'make'],
],
],
With a static function:
<?php
namespace App\Logging;
use Monolog\Logger;
class MyCustomLogger
{
public static function make(array $config)
{
return new Logger(...);
}
}
Also added is a Blade::include() for include aliases. Take the following template for example:
<input type="{{ $type ?? 'text' }}">
With the following include:
Blade::include('includes.input');
And finally, here’s how you can use it:
@input(['type' => 'email'])
Here are the full release notes from the Laravel 5.6 changelog:
v5.6.4 (2018-02-21)
Added
- Added the ability to set message ID right hand side (#23181)
- Support callbacks as custom log drivers (#23184)
- Added
Blade::include()method for include aliases (#23172) - Added
broadcastType()method to notifications (#23236, 4227bd7)
Changed
- Moved clone logic from
FormRequestServiceProvidertoRequest(b0c2459) - Changed pagination arrow symbols (#23127)
- Update React version in preset (#23134)
- Added an empty error bag when rendering HTTP exception views (#23139)
- Normalized actions when using
route:listcommand (#23148) - Updated required Carbon version (201bbec)
- Improved
BadMethodCallExceptionmessages (#23232) - Support date validation rules when comparison has relative time (#23211)
Fixed
- Returns same
Loggerinstance fromLogManager(#23118) - Register missing
hash.driverDI (#23114) - Fixed an issue with starting two database transactions in tests (#23132)
- Don’t replace
tightenco/collect(#23147, #23153, #23160) - Catch
InvalidFileExceptionwhen loading invalid environment file (#23149, 5695079) - Fixed an issue with
assertRedirect()(#23176) - Fixed dropdown accessibility (#23191)
- Fixed
--forceflag onGeneratorCommand(#23230)