|
4
|
1 <?php
|
|
|
2
|
|
|
3 namespace {{ namespace }};
|
|
|
4
|
|
|
5 use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
6 use Illuminate\Database\Eloquent\Model;
|
|
5
|
7 use Illuminate\Database\Eloquent\SoftDeletes;
|
|
4
|
8
|
|
|
9 class {{ class }} extends Model
|
|
|
10 {
|
|
5
|
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
|
|
|
44
|
|
|
45 //relations
|
|
|
46
|
|
|
47 // BelongsTo
|
|
|
48
|
|
|
49 // HasMany
|
|
|
50
|
|
|
51
|
|
4
|
52 }
|