34 lines
686 B
PHP
34 lines
686 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Blade;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class ViewServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// https://laravel-tricks.com/tricks/a-new-at-action-directive
|
|
Blade::if(
|
|
'action', function ($action) {
|
|
if (Route::getCurrentRoute()->getActionMethod() == $action) {
|
|
return $action;
|
|
};
|
|
}
|
|
);
|
|
}
|
|
}
|