I have an observer for one of my models. This Observer is only checking the creating and updating events. For some reason, the creating method works but the updating does not.
Am I doing something wrong in the code?
<?php
namespace App\Observers;
use App\Models\Container;
class ContainerObserver
{
/**
* Handle the container "creating" event.
*
* @param App\Models\Container $container
* @return void
*/
public function creating(Container $container)
{
\Log::info("Creating...");
$container->dummy = (!is_null($container->device_id))? false : true;
}
/**
* Handle the container "updating" event.
*
* @param App\Models\Container $container
* @return void
*/
public function updating(Container $container)
{
\Log::info("Updating");
$container->dummy = (!is_null($container->device_id))? false : true;
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire