diff src/Generator/Model/stubs/model.stub @ 5:b0b2e79ad8e6

Not exatly sure what was changed but commiting to it :)
author luka
date Thu, 12 Oct 2023 19:41:04 -0400
parents a20439b1c9d3
children 3426c7e91c24
line wrap: on
line diff
--- a/src/Generator/Model/stubs/model.stub	Tue Jun 27 20:16:55 2023 -0400
+++ b/src/Generator/Model/stubs/model.stub	Thu Oct 12 19:41:04 2023 -0400
@@ -4,8 +4,40 @@
 
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
 
 class {{ class }} extends Model
 {
-    use HasFactory;
+    //use HasFactory;
+    use SoftDeletes;
+
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected $table = '{{ tableName }}';
+
+		/**
+     * The model's default values for attributes.
+     *
+     * @var array
+     */
+    protected $attributes = [
+			# {{ atributeInsertPoint }}
+    ];
+
+
+		public static function boot() : void {
+			parent::boot();
+
+			self::creating(function ($item) {
+				$item->created_by = \Auth::user()->id;
+				$item->updated_by = \Auth::user()->id;
+			});
+
+			self::saving(function ($item) {
+				$item->updated_by = \Auth::user()->id;
+			});
+		}
 }