We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Stop all inbuilt model dispatch events for a specific model.
Advantage: applications will take less memory and improve performance.
Disadvantage: you can not use the Observer class for that model.
namespace App\Models;
class User extends Model
{
// First way: by using a static property
public static $dispatcher = null;
// Second way: in the constructor
public function __construct()
{
// if (!App::isLocal()) {
self::unsetEventDispatcher();
// }
}
}
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.