This commit is contained in:
2024-09-01 18:54:23 +05:00
parent 76d18365a5
commit 061f09eca1
1597 changed files with 109451 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace Laravel\Nova\Concerns;
use Illuminate\Support\Facades\Event;
use Laravel\Nova\Events\NovaServiceProviderRegistered;
use Laravel\Nova\Events\ServingNova;
trait InteractsWithEvents
{
/**
* Register an event listener for the Nova "booted" event.
*
* @param (\Closure(\Laravel\Nova\Events\NovaServiceProviderRegistered):(void))|string $callback
* @return void
*/
public static function booted($callback)
{
Event::listen(NovaServiceProviderRegistered::class, $callback);
}
/**
* Register an event listener for the Nova "serving" event.
*
* @param (\Closure(\Laravel\Nova\Events\ServingNova):(void))|string $callback
* @return void
*/
public static function serving($callback)
{
Event::listen(ServingNova::class, $callback);
}
/**
* Flush the persistent Nova state.
*
* @return void
*/
public static function flushState()
{
static::$rtlCallback = null;
static::$createUserCallback = null;
static::$createUserCommandCallback = null;
static::$dashboards = [];
static::$jsonVariables = [];
static::$resources = [];
static::$resourcesByModel = [];
static::$scripts = [];
static::$styles = [];
static::$tools = [];
}
}