@@ -7,7 +7,7 @@ |
||
7 | 7 | class Products extends Model |
8 | 8 | { |
9 | 9 | protected $table = 'sd_products'; |
10 | - protected $fillable = ['id','name','description','manufacture','asset_type_id','product_status_id','product_mode_procurement_id','all_department','created_at','updated_at', |
|
10 | + protected $fillable = ['id', 'name', 'description', 'manufacture', 'asset_type_id', 'product_status_id', 'product_mode_procurement_id', 'all_department', 'created_at', 'updated_at', |
|
11 | 11 | |
12 | 12 | ]; |
13 | 13 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class Vendors extends Model |
8 | 8 | { |
9 | 9 | protected $table = 'sd_vendors'; |
10 | - protected $fillable = ['id','name','primarycontact','email','description','address','all_department','status','created_at','updated_at', |
|
10 | + protected $fillable = ['id', 'name', 'primarycontact', 'email', 'description', 'address', 'all_department', 'status', 'created_at', 'updated_at', |
|
11 | 11 | |
12 | 12 | ]; |
13 | 13 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class Approver extends Model |
8 | 8 | { |
9 | 9 | protected $table = 'sd_aapprover'; |
10 | - protected $fillable = ['id','name','created_at','updated_at', |
|
10 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at', |
|
11 | 11 | |
12 | 12 | ]; |
13 | 13 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | class SdProcurment extends Model |
10 | 10 | { |
11 | 11 | protected $table = 'sd_product_proc_mode'; |
12 | - protected $fillable = ['id','name','created_at','updated_at', |
|
12 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at', |
|
13 | 13 | |
14 | 14 | ]; |
15 | 15 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | class Group extends Model |
10 | 10 | { |
11 | 11 | protected $table = 'sd_group_types'; |
12 | - protected $fillable = ['id','name','created_at','updated_at', |
|
12 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at', |
|
13 | 13 | |
14 | 14 | ]; |
15 | 15 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class Attachments extends Model |
8 | 8 | { |
9 | 9 | protected $table = 'sd_attachments'; |
10 | - protected $fillable = ['id','saved','owner','value','type','size','created_at','updated_at', |
|
10 | + protected $fillable = ['id', 'saved', 'owner', 'value', 'type', 'size', 'created_at', 'updated_at', |
|
11 | 11 | |
12 | 12 | ]; |
13 | 13 | } |
@@ -238,7 +238,7 @@ |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | public function changeRelaion(){ |
241 | - $through = "App\Plugins\ServiceDesk\Model\Problem\ProblemChangeRelation"; |
|
241 | + $through = "App\Plugins\ServiceDesk\Model\Problem\ProblemChangeRelation"; |
|
242 | 242 | $firstKey = 'problem_id'; |
243 | 243 | return $this->hasMany($through, $firstKey); |
244 | 244 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | return $value; |
32 | 32 | } |
33 | 33 | |
34 | - public function organization(){ |
|
34 | + public function organization() { |
|
35 | 35 | $value = "--"; |
36 | 36 | $attr = $this->attributes['from']; |
37 | 37 | if ($attr) { |
@@ -48,29 +48,29 @@ discard block |
||
48 | 48 | * get the assets |
49 | 49 | * @return type |
50 | 50 | */ |
51 | - public function assets(){ |
|
51 | + public function assets() { |
|
52 | 52 | $table = $this->table; |
53 | 53 | $id = $this->attributes['id']; |
54 | 54 | $owner = "$table:$id"; |
55 | 55 | $ids = []; |
56 | 56 | $relations = new \App\Plugins\ServiceDesk\Model\Common\AssetRelation(); |
57 | - $relation = $relations->where('owner',$owner)->first(); |
|
58 | - if($relation){ |
|
57 | + $relation = $relations->where('owner', $owner)->first(); |
|
58 | + if ($relation) { |
|
59 | 59 | $ids = $relation->asset_ids; |
60 | 60 | } |
61 | 61 | return $ids; |
62 | 62 | } |
63 | 63 | |
64 | - public function getAssets(){ |
|
64 | + public function getAssets() { |
|
65 | 65 | $ids = $this->assets(); |
66 | 66 | $asset = new \App\Plugins\ServiceDesk\Model\Assets\SdAssets(); |
67 | 67 | $assets = ""; |
68 | - if(count($ids)>0){ |
|
69 | - foreach($ids as $id){ |
|
68 | + if (count($ids) > 0) { |
|
69 | + foreach ($ids as $id) { |
|
70 | 70 | $ass = $asset->find($id); |
71 | - if($ass){ |
|
71 | + if ($ass) { |
|
72 | 72 | $value = "<a href=".url('service-desk/assets/'.$id.'/show').">".ucfirst($ass->name)."</a>"; |
73 | - $assets .=$value."</br>"; |
|
73 | + $assets .= $value."</br>"; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $value = str_limit($attr, 10); |
204 | 204 | } |
205 | 205 | if (strlen($value) > 10) { |
206 | - $value .=" <a href=# id='show-description'>Show</a>"; |
|
206 | + $value .= " <a href=# id='show-description'>Show</a>"; |
|
207 | 207 | } |
208 | 208 | return ucfirst($value); |
209 | 209 | } |
@@ -227,25 +227,25 @@ discard block |
||
227 | 227 | $table = $this->table; |
228 | 228 | $id = $this->attributes['id']; |
229 | 229 | $owner = "$table:$id"; |
230 | - $relations = $relation->where('owner',$owner)->get(); |
|
231 | - if($relations->count()>0){ |
|
232 | - foreach($relations as $rel){ |
|
233 | - if($rel){ |
|
230 | + $relations = $relation->where('owner', $owner)->get(); |
|
231 | + if ($relations->count() > 0) { |
|
232 | + foreach ($relations as $rel) { |
|
233 | + if ($rel) { |
|
234 | 234 | $rel->delete(); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
240 | - public function changeRelaion(){ |
|
240 | + public function changeRelaion() { |
|
241 | 241 | $through = "App\Plugins\ServiceDesk\Model\Problem\ProblemChangeRelation"; |
242 | 242 | $firstKey = 'problem_id'; |
243 | 243 | return $this->hasMany($through, $firstKey); |
244 | 244 | } |
245 | 245 | |
246 | - public function change(){ |
|
246 | + public function change() { |
|
247 | 247 | $relation = $this->changeRelaion()->first(); |
248 | - if($relation){ |
|
248 | + if ($relation) { |
|
249 | 249 | $changeid = $relation->change_id; |
250 | 250 | $changes = new \App\Plugins\ServiceDesk\Model\Changes\SdChanges(); |
251 | 251 | $change = $changes->find($changeid); |
@@ -280,52 +280,52 @@ discard block |
||
280 | 280 | // return $generals; |
281 | 281 | // } |
282 | 282 | |
283 | - public function generalAttachments($identifier){ |
|
283 | + public function generalAttachments($identifier) { |
|
284 | 284 | $table = $this->table; |
285 | 285 | $id = $this->attributes['id']; |
286 | 286 | //$identifier = "root-cause"; |
287 | 287 | $owner = "$table:$identifier:$id"; |
288 | 288 | $attachment = new \App\Plugins\ServiceDesk\Model\Common\Attachments(); |
289 | - $attachments = $attachment->where('owner',$owner)->get(); |
|
289 | + $attachments = $attachment->where('owner', $owner)->get(); |
|
290 | 290 | return $attachments; |
291 | 291 | } |
292 | - public function getGeneralByIdentifier($identifier){ |
|
292 | + public function getGeneralByIdentifier($identifier) { |
|
293 | 293 | $table = $this->table; |
294 | 294 | $id = $this->attributes['id']; |
295 | 295 | $owner = "$table:$id"; |
296 | 296 | $generals = new \App\Plugins\ServiceDesk\Model\Common\GeneralInfo(); |
297 | - $general = $generals->where('owner',$owner)->where('key',$identifier)->first(); |
|
297 | + $general = $generals->where('owner', $owner)->where('key', $identifier)->first(); |
|
298 | 298 | return $general; |
299 | 299 | |
300 | 300 | } |
301 | 301 | |
302 | - public function table(){ |
|
302 | + public function table() { |
|
303 | 303 | return $this->table; |
304 | 304 | } |
305 | 305 | |
306 | - public function tickets(){ |
|
306 | + public function tickets() { |
|
307 | 307 | |
308 | 308 | $ticket = $this->ticketRelation(); |
309 | - $join = $ticket->join('ticket_thread','tickets.id','=','ticket_thread.ticket_id') |
|
310 | - ->select('tickets.id','tickets.ticket_number','ticket_thread.title') |
|
309 | + $join = $ticket->join('ticket_thread', 'tickets.id', '=', 'ticket_thread.ticket_id') |
|
310 | + ->select('tickets.id', 'tickets.ticket_number', 'ticket_thread.title') |
|
311 | 311 | ->whereNotNull('ticket_thread.title') |
312 | 312 | ->groupBy('tickets.id') |
313 | 313 | ->get(); |
314 | 314 | return $join; |
315 | 315 | } |
316 | 316 | |
317 | - public function ticketRelation(){ |
|
317 | + public function ticketRelation() { |
|
318 | 318 | $problemid = $this->attributes['id']; |
319 | 319 | $table = $this->table; |
320 | 320 | $owner = "$table:$problemid"; |
321 | 321 | $ticket_relation = new \App\Plugins\ServiceDesk\Model\Common\TicketRelation(); |
322 | - $relation = $ticket_relation->where('owner',$owner)->lists('ticket_id')->toArray(); |
|
322 | + $relation = $ticket_relation->where('owner', $owner)->lists('ticket_id')->toArray(); |
|
323 | 323 | $ticket = new \App\Plugins\ServiceDesk\Model\Common\Ticket(); |
324 | - $tickets = $ticket->whereIn('tickets.id',$relation); |
|
324 | + $tickets = $ticket->whereIn('tickets.id', $relation); |
|
325 | 325 | return $tickets; |
326 | 326 | } |
327 | 327 | |
328 | - public function subject(){ |
|
328 | + public function subject() { |
|
329 | 329 | $id = $this->attributes['id']; |
330 | 330 | $title = $this->attributes['subject']; |
331 | 331 | $subject = "<a href=".url('service-desk/problem/'.$id.'/show').">".$title."</a>"; |
@@ -9,7 +9,7 @@ |
||
9 | 9 | class Priority extends Model |
10 | 10 | { |
11 | 11 | protected $table = 'sd_priority_types'; |
12 | - protected $fillable = ['id','name','contract_end_date','created_at','updated_at', |
|
12 | + protected $fillable = ['id', 'name', 'contract_end_date', 'created_at', 'updated_at', |
|
13 | 13 | |
14 | 14 | ]; |
15 | 15 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | class Assigned extends Model |
10 | 10 | { |
11 | 11 | protected $table = 'sd_assigned_types'; |
12 | - protected $fillable = ['id','name','created_at','updated_at', |
|
12 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at', |
|
13 | 13 | |
14 | 14 | ]; |
15 | 15 | } |