/** * @param Brand $model * * @return bool */ public function saving(Brand $model) { // process the image, only if it is there or if it's modified if ($model->isDirty('logo')) { $path = $this->image->init($model, 'logo')->getImage(); if (empty($path)) { return false; } $model->logo = $path; return true; } return true; }