|
@@ -0,0 +1,31 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App;
|
|
|
+
|
|
|
+use Illuminate\Database\Eloquent\Model;
|
|
|
+
|
|
|
+class Task extends Model
|
|
|
+{
|
|
|
+
|
|
|
+ * Returns a collection, so cannot be chained.
|
|
|
+ *
|
|
|
+ * @return \Illuminate\Database\Eloquent\Collection|static[]
|
|
|
+ */
|
|
|
+ public static function incomplete_v0()
|
|
|
+ {
|
|
|
+ return static::where('completed', 0)->get();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Will answer to Task::incomplete() too but know it is a query scope.
|
|
|
+ *
|
|
|
+ * @param $query
|
|
|
+ * The existing query.
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function scopeIncomplete($query)
|
|
|
+ {
|
|
|
+ return $query->where('completed', 0);
|
|
|
+ }
|
|
|
+}
|