Mercurial > packages > magicforger
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 4:a20439b1c9d3 | 5:b0b2e79ad8e6 |
|---|---|
| 2 | 2 |
| 3 namespace {{ namespace }}; | 3 namespace {{ namespace }}; |
| 4 | 4 |
| 5 use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 6 use Illuminate\Database\Eloquent\Model; | 6 use Illuminate\Database\Eloquent\Model; |
| 7 use Illuminate\Database\Eloquent\SoftDeletes; | |
| 7 | 8 |
| 8 class {{ class }} extends Model | 9 class {{ class }} extends Model |
| 9 { | 10 { |
| 10 use HasFactory; | 11 //use HasFactory; |
| 12 use SoftDeletes; | |
| 13 | |
| 14 /** | |
| 15 * The table associated with the model. | |
| 16 * | |
| 17 * @var string | |
| 18 */ | |
| 19 protected $table = '{{ tableName }}'; | |
| 20 | |
| 21 /** | |
| 22 * The model's default values for attributes. | |
| 23 * | |
| 24 * @var array | |
| 25 */ | |
| 26 protected $attributes = [ | |
| 27 # {{ atributeInsertPoint }} | |
| 28 ]; | |
| 29 | |
| 30 | |
| 31 public static function boot() : void { | |
| 32 parent::boot(); | |
| 33 | |
| 34 self::creating(function ($item) { | |
| 35 $item->created_by = \Auth::user()->id; | |
| 36 $item->updated_by = \Auth::user()->id; | |
| 37 }); | |
| 38 | |
| 39 self::saving(function ($item) { | |
| 40 $item->updated_by = \Auth::user()->id; | |
| 41 }); | |
| 42 } | |
| 11 } | 43 } |
