File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 22
33namespace Givebutter \LaravelCustomFields \Models ;
44
5+ use Carbon \Carbon ;
56use Illuminate \Database \Eloquent \Factories \HasFactory ;
67use Illuminate \Database \Eloquent \Model ;
78use Illuminate \Database \Eloquent \SoftDeletes ;
@@ -123,6 +124,34 @@ public function responses()
123124 return $ this ->hasMany (CustomFieldResponse::class, 'field_id ' );
124125 }
125126
127+ /**
128+ * Archive the model.
129+ *
130+ * @return $this
131+ */
132+ public function archive ()
133+ {
134+ $ this ->forceFill ([
135+ 'archived_at ' => now (),
136+ ])->save ();
137+
138+ return $ this ;
139+ }
140+
141+ /**
142+ * Unarchive the model.
143+ *
144+ * @return $this
145+ */
146+ public function unarchive ()
147+ {
148+ $ this ->forceFill ([
149+ 'archived_at ' => null ,
150+ ])->save ();
151+
152+ return $ this ;
153+ }
154+
126155 /**
127156 * Get the validation rules attribute.
128157 *
You can’t perform that action at this time.
0 commit comments