annotate app/Models/Client.php @ 2:90296614b7e2 default tip

Adding in the base for the clients table
author luka
date Thu, 28 Aug 2025 20:55:40 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
1 <?php
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
2
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
3 namespace App\Models;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
4
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
5 use Illuminate\Database\Eloquent\SoftDeletes;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
6 use Wizard\Framework\Models\BaseModel;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
7
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
8 class Client extends BaseModel
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
9 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
10 // use HasFactory;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
11 use SoftDeletes;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
12
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
13 /**
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
14 * The table associated with the model.
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
15 *
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
16 * @var string
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
17 */
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
18 protected $table = 'clients';
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
19
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
20 /**
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
21 * The model's default values for attributes.
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
22 *
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
23 * @var array
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
24 */
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
25 protected $attributes = [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
26 // {{ atributeInsertPoint }}
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
27 ];
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
28
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
29 protected $casts = [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
30
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
31 ];
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
32
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
33 protected $fillable = [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
34 'name',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
35 'email',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
36 'phone_number',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
37 'address',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
38 'notes',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
39
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
40 ];
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
41
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
42 protected $default_relations = [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
43
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
44 ];
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
45
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
46 protected static $filters = [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
47 'name' => [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
48 'column_name' => 'name',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
49 'table' => 'clients',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
50 'display' => 'Name',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
51 'type' => 'value',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
52 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
53 'email' => [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
54 'column_name' => 'email',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
55 'table' => 'clients',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
56 'display' => 'Email',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
57 'type' => 'value',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
58 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
59 'phone_number' => [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
60 'column_name' => 'phone_number',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
61 'table' => 'clients',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
62 'display' => 'Phone Number',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
63 'type' => 'value',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
64 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
65 'address' => [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
66 'column_name' => 'address',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
67 'table' => 'clients',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
68 'display' => 'Address',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
69 'type' => 'value',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
70 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
71 'notes' => [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
72 'column_name' => 'notes',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
73 'table' => 'clients',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
74 'display' => 'Notes',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
75 'type' => 'value',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
76 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
77
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
78 ];
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
79
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
80 public static function get_filters()
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
81 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
82 return static::filters;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
83 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
84
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
85 // relations
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
86
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
87 // BelongsTo
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
88
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
89 // HasMany
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
90
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
91 // HasManyThrough
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
92
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
93 /**
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
94 * Load the default relations for the model.
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
95 *
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
96 * @return $this
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
97 */
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
98 public function load_relations()
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
99 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
100 foreach ($this->default_relations as $relation) {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
101 $this->load($relation);
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
102 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
103
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
104 return $this;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
105 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
106
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
107 /**
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
108 * Retrieve a query builder instance with default relations loaded.
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
109 *
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
110 * @return \Illuminate\Database\Eloquent\Builder
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
111 */
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
112 public static function data_query()
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
113 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
114 return parent::data_query();
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
115 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
116
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
117 /**
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
118 * Retrieve a query builder instance with default relations loaded.
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
119 *
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
120 * @return \Illuminate\Database\Eloquent\Builder
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
121 */
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
122 public static function get_data(array $validated = [])
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
123 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
124 return parent::get_data($validated);
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
125 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
126 }