Skip to content

Commit

Permalink
Merge pull request #9 from RonasIT/dpankratov/version-update
Browse files Browse the repository at this point in the history
#-:
  • Loading branch information
DenTray authored Aug 22, 2019
2 parents 02ce738 + dc151e9 commit 0b33c8a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Traits/EntityControlTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace RonasIT\Support\Traits;

use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use RonasIT\Support\Exceptions\InvalidModelException;
use RonasIT\Support\Exceptions\PostValidationException;
use Illuminate\Support\Arr;

/**
* @property Model model
Expand Down Expand Up @@ -135,7 +135,7 @@ public function create($data)
if (!empty($this->requiredRelations)) {
$model->load($this->requiredRelations);
}

$this->afterCreateHook($model, $data);

return $model->refresh()->toArray();
Expand All @@ -156,8 +156,7 @@ public function updateMany($where, array $data)
$entityData = Arr::only($data, $fields);

$this
->getQuery()
->where($where)
->getQuery($where)
->update($entityData);

return $this->get(array_merge($where, $entityData));
Expand Down Expand Up @@ -415,12 +414,12 @@ protected function checkPrimaryKey()
throw new InvalidModelException("Model {$modelClass} must have primary key.");
}
}

protected function afterUpdateHook($entity, $data)
{
// implement it yourself if you need it
}

protected function afterCreateHook($entity, $data)
{
// implement it yourself if you need it
Expand Down

0 comments on commit 0b33c8a

Please sign in to comment.