name); $model->picture = FileStorageHelper::storeFile($model, $model->picture, true); } /** * Asserts using validation that the field is unique. * * @param string $nameField * @param mixed $valueField * @param integer|null $id * @return void */ private static function assertFieldIsUnique(string $nameField, string $valueField, ?int $id = null) { $table = (new self())->getTable(); ToolboxHelper::assertFieldIsUnique($table, $nameField, $valueField, $id); } // * RELATIONSHIPS /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function stores() { return $this->hasMany('App\Models\Store', 'region_id'); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function storeGroup() { return $this->belongsTo('App\Models\StoreGroup', 'group_id'); } }