diff --git a/src/Traits/EntityControlTrait.php b/src/Traits/EntityControlTrait.php index 798170d7..be9ced72 100644 --- a/src/Traits/EntityControlTrait.php +++ b/src/Traits/EntityControlTrait.php @@ -131,6 +131,20 @@ public function firstWithRelations($data, $with = []) return empty($entity) ? [] : $entity->toArray(); } + public function findBy($field, $value, $relations = []) + { + return $this->firstWithRelations([ + $field => $value + ], $relations); + } + + public function find($id, $relations = []) + { + return $this->firstWithRelations([ + 'id' => $id + ], $relations); + } + public function delete($where) { $model = new $this->model;