WithoutModelEvents.php
TLDR
This file contains a trait called WithoutModelEvents
that provides a method withoutModelEvents()
to prevent model events from being dispatched by a given callback.
Methods
withoutModelEvents
Prevents model events from being dispatched by the provided callback.
- Parameters:
-
callable $callback
: The callback function that will be executed without model events being dispatched.
-
- Return value:
- The modified callback function.
Classes
<?php
namespace Illuminate\Database\Console\Seeds;
use Illuminate\Database\Eloquent\Model;
trait WithoutModelEvents
{
/**
* Prevent model events from being dispatched by the given callback.
*
* @param callable $callback
* @return callable
*/
public function withoutModelEvents(callable $callback)
{
return fn () => Model::withoutEvents($callback);
}
}