@@ -7,5 +7,5 @@ |
||
7 | 7 | { |
8 | 8 | protected $table = 'sd_release_status'; |
9 | 9 | |
10 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
10 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -6,5 +6,5 @@ |
||
6 | 6 | class SdLocations extends Model |
7 | 7 | { |
8 | 8 | protected $table = 'sd_locations'; |
9 | - protected $fillable = ['id','location_category_id','title','email','phone','address','all_department_access','departments','status','created_at','updated_at']; |
|
9 | + protected $fillable = ['id', 'location_category_id', 'title', 'email', 'phone', 'address', 'all_department_access', 'departments', 'status', 'created_at', 'updated_at']; |
|
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return ucfirst($value); |
57 | 57 | } |
58 | 58 | |
59 | - public function status(){ |
|
59 | + public function status() { |
|
60 | 60 | return $this->belongsTo('App\Plugins\ServiceDesk\Model\Releases\SdReleasestatus', 'status_id'); |
61 | 61 | } |
62 | 62 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | return ucfirst($value); |
77 | 77 | } |
78 | 78 | |
79 | - public function priority(){ |
|
80 | - return $this->belongsTo('App\Plugins\ServiceDesk\Model\Releases\SdReleasepriorities','priority_id'); |
|
79 | + public function priority() { |
|
80 | + return $this->belongsTo('App\Plugins\ServiceDesk\Model\Releases\SdReleasepriorities', 'priority_id'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | return ucfirst($value); |
97 | 97 | } |
98 | 98 | |
99 | - public function releaseType(){ |
|
100 | - return $this->belongsTo('App\Plugins\ServiceDesk\Model\Releases\SdReleasetypes','release_type_id'); |
|
99 | + public function releaseType() { |
|
100 | + return $this->belongsTo('App\Plugins\ServiceDesk\Model\Releases\SdReleasetypes', 'release_type_id'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function releaseTypes() { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $value = str_limit($attr, 10); |
124 | 124 | } |
125 | 125 | if (strlen($value) > 10) { |
126 | - $value .=" <a href=# id='show-description'>Show</a>"; |
|
126 | + $value .= " <a href=# id='show-description'>Show</a>"; |
|
127 | 127 | } |
128 | 128 | return ucfirst($value); |
129 | 129 | } |
@@ -138,29 +138,29 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | - public function assets(){ |
|
141 | + public function assets() { |
|
142 | 142 | $table = $this->table; |
143 | 143 | $id = $this->attributes['id']; |
144 | 144 | $owner = "$table:$id"; |
145 | 145 | $ids = []; |
146 | 146 | $relations = new \App\Plugins\ServiceDesk\Model\Common\AssetRelation(); |
147 | - $relation = $relations->where('owner',$owner)->first(); |
|
148 | - if($relation){ |
|
147 | + $relation = $relations->where('owner', $owner)->first(); |
|
148 | + if ($relation) { |
|
149 | 149 | $ids = $relation->asset_ids; |
150 | 150 | } |
151 | 151 | return $ids; |
152 | 152 | } |
153 | 153 | |
154 | - public function getAssets(){ |
|
154 | + public function getAssets() { |
|
155 | 155 | $ids = $this->assets(); |
156 | 156 | $asset = new \App\Plugins\ServiceDesk\Model\Assets\SdAssets(); |
157 | 157 | $assets = ""; |
158 | - if(count($ids)>0){ |
|
159 | - foreach($ids as $id){ |
|
158 | + if (count($ids) > 0) { |
|
159 | + foreach ($ids as $id) { |
|
160 | 160 | $ass = $asset->find($id); |
161 | - if($ass){ |
|
161 | + if ($ass) { |
|
162 | 162 | $value = "<a href=".url('service-desk/assets/'.$id.'/show').">".ucfirst($ass->name)."</a>"; |
163 | - $assets .=$value."</br>"; |
|
163 | + $assets .= $value."</br>"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -188,29 +188,29 @@ discard block |
||
188 | 188 | $this->detachRelation($id); |
189 | 189 | parent::delete(); |
190 | 190 | } |
191 | - public function table(){ |
|
191 | + public function table() { |
|
192 | 192 | return $this->table; |
193 | 193 | } |
194 | - public function generalAttachments($identifier){ |
|
194 | + public function generalAttachments($identifier) { |
|
195 | 195 | $table = $this->table; |
196 | 196 | $id = $this->attributes['id']; |
197 | 197 | //$identifier = "root-cause"; |
198 | 198 | $owner = "$table:$identifier:$id"; |
199 | 199 | $attachment = new \App\Plugins\ServiceDesk\Model\Common\Attachments(); |
200 | - $attachments = $attachment->where('owner',$owner)->get(); |
|
200 | + $attachments = $attachment->where('owner', $owner)->get(); |
|
201 | 201 | return $attachments; |
202 | 202 | } |
203 | - public function getGeneralByIdentifier($identifier){ |
|
203 | + public function getGeneralByIdentifier($identifier) { |
|
204 | 204 | $table = $this->table; |
205 | 205 | $id = $this->attributes['id']; |
206 | 206 | $owner = "$table:$id"; |
207 | 207 | $generals = new \App\Plugins\ServiceDesk\Model\Common\GeneralInfo(); |
208 | - $general = $generals->where('owner',$owner)->where('key',$identifier)->first(); |
|
208 | + $general = $generals->where('owner', $owner)->where('key', $identifier)->first(); |
|
209 | 209 | return $general; |
210 | 210 | |
211 | 211 | } |
212 | 212 | |
213 | - public function subject(){ |
|
213 | + public function subject() { |
|
214 | 214 | $id = $this->attributes['id']; |
215 | 215 | $title = $this->attributes['subject']; |
216 | 216 | $subject = "<a href=".url('service-desk/releases/'.$id.'/show').">".$title."</a>"; |
@@ -7,5 +7,5 @@ |
||
7 | 7 | { |
8 | 8 | protected $table = 'sd_release_types'; |
9 | 9 | |
10 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
10 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -5,7 +5,7 @@ |
||
5 | 5 | class GeneralInfo extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_gerneral'; |
8 | - protected $fillable = ['owner','key','value']; |
|
8 | + protected $fillable = ['owner', 'key', 'value']; |
|
9 | 9 | |
10 | 10 | |
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -3,31 +3,31 @@ discard block |
||
3 | 3 | use App\Model\helpdesk\Ticket\Tickets; |
4 | 4 | class Ticket extends Tickets |
5 | 5 | { |
6 | - public function ticketRelation(){ |
|
7 | - return $this->hasMany("App\Plugins\ServiceDesk\Model\Common\TicketRelation","ticket_id"); |
|
6 | + public function ticketRelation() { |
|
7 | + return $this->hasMany("App\Plugins\ServiceDesk\Model\Common\TicketRelation", "ticket_id"); |
|
8 | 8 | } |
9 | 9 | |
10 | - public function getTicketRelation($table){ |
|
10 | + public function getTicketRelation($table) { |
|
11 | 11 | //dd($table); |
12 | - $relation = $this->ticketRelation()->where('owner','LIKE',$table."%")->first(); |
|
13 | - if($relation){ |
|
12 | + $relation = $this->ticketRelation()->where('owner', 'LIKE', $table."%")->first(); |
|
13 | + if ($relation) { |
|
14 | 14 | |
15 | - $owner =$relation->owner; |
|
15 | + $owner = $relation->owner; |
|
16 | 16 | $explode = explode(':', $owner); |
17 | 17 | $shcema = array_first($explode); |
18 | 18 | $id = array_last($explode); |
19 | 19 | $model = $this->switchCase($shcema, $id); |
20 | - if($model){ |
|
20 | + if ($model) { |
|
21 | 21 | return $model; |
22 | 22 | } |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - public function switchCase($table,$id){ |
|
26 | + public function switchCase($table, $id) { |
|
27 | 27 | $problem = new \App\Plugins\ServiceDesk\Model\Problem\SdProblem(); |
28 | 28 | $asset = new \App\Plugins\ServiceDesk\Model\Assets\SdAssets(); |
29 | 29 | $change = new \App\Plugins\ServiceDesk\Model\Changes\SdChanges(); |
30 | - switch ($table){ |
|
30 | + switch ($table) { |
|
31 | 31 | case "sd_problem": |
32 | 32 | return $problem->find($id); |
33 | 33 | case "sd_assets": |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public function table(){ |
|
40 | + public function table() { |
|
41 | 41 | return $this->table; |
42 | 42 | } |
43 | 43 | |
44 | - public function statuses(){ |
|
44 | + public function statuses() { |
|
45 | 45 | $name = "--"; |
46 | 46 | $status = $this->statusRelation()->first(); |
47 | - if($status){ |
|
47 | + if ($status) { |
|
48 | 48 | $name = $status->name; |
49 | 49 | } |
50 | 50 | return $name; |
51 | 51 | } |
52 | 52 | |
53 | - public function statusRelation(){ |
|
53 | + public function statusRelation() { |
|
54 | 54 | $related = "App\Model\helpdesk\Ticket\Ticket_Status"; |
55 | - return $this->belongsTo($related,'status'); |
|
55 | + return $this->belongsTo($related, 'status'); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function subject(){ |
|
58 | + public function subject() { |
|
59 | 59 | $subject = ""; |
60 | 60 | $thread = $this->thread()->whereNotNull('title')->first(); |
61 | 61 | $id = $this->attributes['id']; |
62 | - if($thread){ |
|
62 | + if ($thread) { |
|
63 | 63 | $title = $thread->title; |
64 | 64 | $subject = "<a href=".url('thread/'.$id).">".$title."</a>"; |
65 | 65 | } |
@@ -5,6 +5,6 @@ |
||
5 | 5 | class ProductVendorRelation extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_product_vendor_relation'; |
8 | - protected $fillable = ['product_id','vendor_id']; |
|
8 | + protected $fillable = ['product_id', 'vendor_id']; |
|
9 | 9 | |
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -5,6 +5,6 @@ |
||
5 | 5 | class TicketRelation extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_ticket_relation'; |
8 | - protected $fillable = ['ticket_id','owner']; |
|
8 | + protected $fillable = ['ticket_id', 'owner']; |
|
9 | 9 | |
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class Attachments extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_attachments'; |
8 | - protected $fillable = ['saved','owner','value','type','size']; |
|
8 | + protected $fillable = ['saved', 'owner', 'value', 'type', 'size']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |