@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdProductstatus extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_product_status'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -88,69 +88,69 @@ |
||
88 | 88 | $value = str_limit($attr, 10); |
89 | 89 | } |
90 | 90 | if (strlen($value) > 10) { |
91 | - $value .=" <a href=# id='show-description'>Show</a>"; |
|
91 | + $value .= " <a href=# id='show-description'>Show</a>"; |
|
92 | 92 | } |
93 | 93 | return ucfirst($value); |
94 | 94 | } |
95 | 95 | |
96 | - public function statuses(){ |
|
96 | + public function statuses() { |
|
97 | 97 | $value = "--"; |
98 | 98 | $attr = $this->attributes['status']; |
99 | - if ($attr==1) { |
|
99 | + if ($attr == 1) { |
|
100 | 100 | $value = "Enabled"; |
101 | - }else{ |
|
101 | + } else { |
|
102 | 102 | $value = "Disabled"; |
103 | 103 | } |
104 | 104 | return $value; |
105 | 105 | } |
106 | - public function vendorRelation(){ |
|
107 | - return $this->hasMany("App\Plugins\ServiceDesk\Model\Common\ProductVendorRelation",'product_id'); |
|
106 | + public function vendorRelation() { |
|
107 | + return $this->hasMany("App\Plugins\ServiceDesk\Model\Common\ProductVendorRelation", 'product_id'); |
|
108 | 108 | } |
109 | 109 | |
110 | - public function vendors(){ |
|
110 | + public function vendors() { |
|
111 | 111 | $vendorids = $this->vendorRelation()->lists('vendor_id')->toArray(); |
112 | 112 | $vendor = new \App\Plugins\ServiceDesk\Model\Vendor\SdVendors(); |
113 | - $vendors = $vendor->whereIn('id',$vendorids)->get(); |
|
113 | + $vendors = $vendor->whereIn('id', $vendorids)->get(); |
|
114 | 114 | return $vendors; |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | - public function assetRelation(){ |
|
119 | - return $this->hasMany('App\Plugins\ServiceDesk\Model\Assets\SdAssets','product_id'); |
|
118 | + public function assetRelation() { |
|
119 | + return $this->hasMany('App\Plugins\ServiceDesk\Model\Assets\SdAssets', 'product_id'); |
|
120 | 120 | } |
121 | - public function assets(){ |
|
121 | + public function assets() { |
|
122 | 122 | $relation = $this->assetRelation(); |
123 | 123 | $assets = $relation->get(); |
124 | 124 | return $assets; |
125 | 125 | } |
126 | 126 | |
127 | - public function deleteProductInAsset(){ |
|
127 | + public function deleteProductInAsset() { |
|
128 | 128 | $asset = $this->assetRelation()->first(); |
129 | - if($asset){ |
|
129 | + if ($asset) { |
|
130 | 130 | $asset->product_id = NULL; |
131 | 131 | $asset->save(); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - public function contractRelation(){ |
|
136 | - return $this->hasMany('App\Plugins\ServiceDesk\Model\Contract\SdContract','product_id'); |
|
135 | + public function contractRelation() { |
|
136 | + return $this->hasMany('App\Plugins\ServiceDesk\Model\Contract\SdContract', 'product_id'); |
|
137 | 137 | } |
138 | - public function deleteProductInContract(){ |
|
138 | + public function deleteProductInContract() { |
|
139 | 139 | $contract = $this->contractRelation()->first(); |
140 | - if($contract){ |
|
140 | + if ($contract) { |
|
141 | 141 | $contract->product_id = NULL; |
142 | 142 | $contract->save(); |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - public function deleteVendorRelation(){ |
|
146 | + public function deleteVendorRelation() { |
|
147 | 147 | $relation = $this->vendorRelation()->first(); |
148 | - if($relation){ |
|
148 | + if ($relation) { |
|
149 | 149 | $relation->delete(); |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - public function delete(){ |
|
153 | + public function delete() { |
|
154 | 154 | $this->deleteProductInAsset(); |
155 | 155 | $this->deleteProductInContract(); |
156 | 156 | $this->deleteVendorRelation(); |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdProductprocmode extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_product_proc_mode'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdLocationcategories extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_location_categories'; |
8 | - protected $fillable = ['id','name','parent_id','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'parent_id', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdChangestatus extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_change_status'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $value = str_limit($attr, 10); |
30 | 30 | } |
31 | 31 | if (strlen($value) > 10) { |
32 | - $value .=" <a href=# id='show-description'>Show</a>"; |
|
32 | + $value .= " <a href=# id='show-description'>Show</a>"; |
|
33 | 33 | } |
34 | 34 | return ucfirst($value); |
35 | 35 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | } |
53 | 53 | return $value; |
54 | 54 | } |
55 | - public function cab(){ |
|
56 | - return $this->belongsTo('App\Plugins\ServiceDesk\Model\Cab\Cab','approval_id'); |
|
55 | + public function cab() { |
|
56 | + return $this->belongsTo('App\Plugins\ServiceDesk\Model\Cab\Cab', 'approval_id'); |
|
57 | 57 | } |
58 | 58 | |
59 | - public function approvers(){ |
|
59 | + public function approvers() { |
|
60 | 60 | $value = "--"; |
61 | 61 | $attr = $this->attributes['approval_id']; |
62 | 62 | $id = $this->attributes['id']; |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | //dd($value); |
72 | 72 | return ucfirst($value); |
73 | 73 | } |
74 | - public function deleteAttachment($id){ |
|
74 | + public function deleteAttachment($id) { |
|
75 | 75 | $table = $this->table; |
76 | 76 | \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deleteAttachments($id, $table); |
77 | 77 | } |
78 | 78 | |
79 | - public function detachRelation($id){ |
|
79 | + public function detachRelation($id) { |
|
80 | 80 | $table = $this->table; |
81 | 81 | $owner = "$table:$id"; |
82 | 82 | $relations = new \App\Plugins\ServiceDesk\Model\Common\AssetRelation(); |
83 | - $relation = $relations->where('owner',$owner)->first(); |
|
84 | - if($relation){ |
|
83 | + $relation = $relations->where('owner', $owner)->first(); |
|
84 | + if ($relation) { |
|
85 | 85 | $relation->delete(); |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - public function delete(){ |
|
89 | + public function delete() { |
|
90 | 90 | $id = $this->id; |
91 | 91 | $this->deleteAttachment($id); |
92 | 92 | $this->detachRelation($id); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return ucfirst($value); |
123 | 123 | } |
124 | 124 | |
125 | - public function status(){ |
|
125 | + public function status() { |
|
126 | 126 | return $this->belongsTo('App\Plugins\ServiceDesk\Model\Changes\SdChangestatus', 'status_id'); |
127 | 127 | } |
128 | 128 | |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | return ucfirst($value); |
143 | 143 | } |
144 | 144 | |
145 | - public function priority(){ |
|
146 | - return $this->belongsTo('App\Plugins\ServiceDesk\Model\Changes\SdChangepriorities','priority_id'); |
|
145 | + public function priority() { |
|
146 | + return $this->belongsTo('App\Plugins\ServiceDesk\Model\Changes\SdChangepriorities', 'priority_id'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -178,40 +178,40 @@ discard block |
||
178 | 178 | } |
179 | 179 | return ucfirst($value); |
180 | 180 | } |
181 | - public function assets(){ |
|
181 | + public function assets() { |
|
182 | 182 | $table = $this->table; |
183 | 183 | $id = $this->attributes['id']; |
184 | 184 | $owner = "$table:$id"; |
185 | 185 | $ids = []; |
186 | 186 | $relations = new \App\Plugins\ServiceDesk\Model\Common\AssetRelation(); |
187 | - $relation = $relations->where('owner',$owner)->first(); |
|
188 | - if($relation){ |
|
187 | + $relation = $relations->where('owner', $owner)->first(); |
|
188 | + if ($relation) { |
|
189 | 189 | $ids = $relation->asset_ids; |
190 | 190 | } |
191 | 191 | return $ids; |
192 | 192 | } |
193 | 193 | |
194 | - public function getAssets(){ |
|
194 | + public function getAssets() { |
|
195 | 195 | $ids = $this->assets(); |
196 | 196 | $asset = new \App\Plugins\ServiceDesk\Model\Assets\SdAssets(); |
197 | 197 | $assets = ""; |
198 | - if(count($ids)>0){ |
|
199 | - foreach($ids as $id){ |
|
198 | + if (count($ids) > 0) { |
|
199 | + foreach ($ids as $id) { |
|
200 | 200 | $ass = $asset->find($id); |
201 | - if($ass){ |
|
201 | + if ($ass) { |
|
202 | 202 | $value = "<a href=".url('service-desk/assets/'.$id.'/show').">".ucfirst($ass->name)."</a>"; |
203 | - $assets .=$value."</br>"; |
|
203 | + $assets .= $value."</br>"; |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | return $assets; |
208 | 208 | } |
209 | 209 | |
210 | - public function changeType(){ |
|
211 | - return $this->belongsTo('App\Plugins\ServiceDesk\Model\Changes\SdChangetypes','change_type_id'); |
|
210 | + public function changeType() { |
|
211 | + return $this->belongsTo('App\Plugins\ServiceDesk\Model\Changes\SdChangetypes', 'change_type_id'); |
|
212 | 212 | } |
213 | 213 | |
214 | - public function changeTypes(){ |
|
214 | + public function changeTypes() { |
|
215 | 215 | $value = "--"; |
216 | 216 | $attr = $this->attributes['change_type_id']; |
217 | 217 | if ($attr) { |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | return ucfirst($value); |
224 | 224 | } |
225 | 225 | |
226 | - public function releaseRelaion(){ |
|
226 | + public function releaseRelaion() { |
|
227 | 227 | $through = "App\Plugins\ServiceDesk\Model\Changes\ChangeReleaseRelation"; |
228 | 228 | $firstKey = 'change_id'; |
229 | 229 | return $this->hasMany($through, $firstKey); |
230 | 230 | } |
231 | 231 | |
232 | - public function release(){ |
|
232 | + public function release() { |
|
233 | 233 | $relation = $this->releaseRelaion()->first(); |
234 | - if($relation){ |
|
234 | + if ($relation) { |
|
235 | 235 | $releaseid = $relation->release_id; |
236 | 236 | $releases = new \App\Plugins\ServiceDesk\Model\Releases\SdReleases(); |
237 | 237 | $release = $releases->find($releaseid); |
@@ -239,33 +239,33 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - public function tickets(){ |
|
242 | + public function tickets() { |
|
243 | 243 | return new \Illuminate\Support\Collection(); |
244 | 244 | } |
245 | 245 | |
246 | - public function table(){ |
|
246 | + public function table() { |
|
247 | 247 | return $this->table; |
248 | 248 | } |
249 | - public function generalAttachments($identifier){ |
|
249 | + public function generalAttachments($identifier) { |
|
250 | 250 | $table = $this->table; |
251 | 251 | $id = $this->attributes['id']; |
252 | 252 | //$identifier = "root-cause"; |
253 | 253 | $owner = "$table:$identifier:$id"; |
254 | 254 | $attachment = new \App\Plugins\ServiceDesk\Model\Common\Attachments(); |
255 | - $attachments = $attachment->where('owner',$owner)->get(); |
|
255 | + $attachments = $attachment->where('owner', $owner)->get(); |
|
256 | 256 | return $attachments; |
257 | 257 | } |
258 | - public function getGeneralByIdentifier($identifier){ |
|
258 | + public function getGeneralByIdentifier($identifier) { |
|
259 | 259 | $table = $this->table; |
260 | 260 | $id = $this->attributes['id']; |
261 | 261 | $owner = "$table:$id"; |
262 | 262 | $generals = new \App\Plugins\ServiceDesk\Model\Common\GeneralInfo(); |
263 | - $general = $generals->where('owner',$owner)->where('key',$identifier)->first(); |
|
263 | + $general = $generals->where('owner', $owner)->where('key', $identifier)->first(); |
|
264 | 264 | return $general; |
265 | 265 | |
266 | 266 | } |
267 | 267 | |
268 | - public function subject(){ |
|
268 | + public function subject() { |
|
269 | 269 | $id = $this->attributes['id']; |
270 | 270 | $title = $this->attributes['subject']; |
271 | 271 | $subject = "<a href=".url('service-desk/changes/'.$id.'/show').">".$title."</a>"; |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdChangetypes extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_change_types'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdChangepriorities extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_change_priorities'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class SdImpacttypes extends Model |
6 | 6 | { |
7 | 7 | protected $table = 'sd_impact_types'; |
8 | - protected $fillable = ['id','name','created_at','updated_at']; |
|
8 | + protected $fillable = ['id', 'name', 'created_at', 'updated_at']; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |