![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/Corals/core/Foundation/Traits/Cache/ |
<?php namespace Corals\Foundation\Traits\Cache; trait ExtendFireModelEventTrait { /** * Fire the given event for the model. * * @param string $event * @param bool $halt * * @return mixed */ public function fireModelEvent($event, $halt = true, $relationName = null, $ids = [], $idsAttributes = []) { if (!isset(static::$dispatcher)) { return true; } // First, we will get the proper method to call on the event dispatcher, and then we // will attempt to fire a custom, object based event for the given event. If that // returns a result we can return that result, or we'll call the string events. $method = $halt ? 'until' : 'dispatch'; $result = $this->filterModelEventResults( $this->fireCustomModelEvent($event, $method) ); if (false === $result) { return false; } $payload = ['model' => $this, 'relation' => $relationName, 'pivotIds' => $ids, 'pivotIdsAttributes' => $idsAttributes]; return !empty($result) ? $result : static::$dispatcher->{$method}( "eloquent.{$event}: ".static::class, $payload ); } }