summaryrefslogtreecommitdiff
path: root/src/Models/BaseModel.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-30 19:31:14 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-30 19:33:14 +0200
commitb46207f91176cf944284c01c213d3f69075377a4 (patch)
tree3d04a46c84c8b66b2d5a56a851249fde80257e28 /src/Models/BaseModel.php
parent6187eed3bb08f200050a3078bd762b5731dfbe78 (diff)
parent0b0890f425ced27b2204a046296de4cccdac4eb8 (diff)
Merge remote-tracking branch 'MyIgel/session'
Diffstat (limited to 'src/Models/BaseModel.php')
-rw-r--r--src/Models/BaseModel.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Models/BaseModel.php b/src/Models/BaseModel.php
index cf718e4f..d5ded428 100644
--- a/src/Models/BaseModel.php
+++ b/src/Models/BaseModel.php
@@ -2,6 +2,8 @@
namespace Engelsystem\Models;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
abstract class BaseModel extends Model
@@ -10,6 +12,8 @@ abstract class BaseModel extends Model
public $timestamps = false;
/**
+ * Create a new model
+ *
* @param array $attributes
* @return BaseModel
*/
@@ -20,4 +24,16 @@ abstract class BaseModel extends Model
return $instance;
}
+
+ /**
+ * Find a model by its primary key
+ *
+ * @param mixed $id
+ * @param array $columns
+ * @return Builder|Builder[]|Collection|Model|null
+ */
+ public static function find($id, $columns = ['*'])
+ {
+ return static::query()->find($id, $columns);
+ }
}