@@ -38,11 +38,11 @@ |
||
38 | 38 | { |
39 | 39 | $validator = parent::getValidatorInstance(); |
40 | 40 | |
41 | - $validator->sometimes('site', 'integer|digits_between:1,10|exists:sites,id', function ($input) { |
|
41 | + $validator->sometimes('site', 'integer|digits_between:1,10|exists:sites,id', function($input) { |
|
42 | 42 | return !$input->new_site_name && $input->site; |
43 | 43 | }); |
44 | 44 | |
45 | - $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function ($input) { |
|
45 | + $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function($input) { |
|
46 | 46 | return !$input->site; |
47 | 47 | }); |
48 | 48 |
@@ -46,19 +46,19 @@ |
||
46 | 46 | { |
47 | 47 | $validator = parent::getValidatorInstance(); |
48 | 48 | |
49 | - $validator->sometimes('site_id', 'bail|integer|digits_between:1,10|exists:sites,id', function ($input) { |
|
49 | + $validator->sometimes('site_id', 'bail|integer|digits_between:1,10|exists:sites,id', function($input) { |
|
50 | 50 | return !$input->new_site_name && $input->site_id; |
51 | 51 | }); |
52 | 52 | |
53 | - $validator->sometimes('location_id', 'bail|integer|digits_between:1,10|exists:locations,id', function ($input) { |
|
53 | + $validator->sometimes('location_id', 'bail|integer|digits_between:1,10|exists:locations,id', function($input) { |
|
54 | 54 | return !$input->new_location_name && $input->location_id; |
55 | 55 | }); |
56 | 56 | |
57 | - $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function ($input) { |
|
57 | + $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function($input) { |
|
58 | 58 | return !$input->site_id && $input->name; |
59 | 59 | }); |
60 | 60 | |
61 | - $validator->sometimes('new_location_name', 'bail|min:2|max:190|name|unique:locations,name', function ($input) { |
|
61 | + $validator->sometimes('new_location_name', 'bail|min:2|max:190|name|unique:locations,name', function($input) { |
|
62 | 62 | return !$input->location_id && $input->name; |
63 | 63 | }); |
64 | 64 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'name' => 'required|min:2|max:190|name|unique:sites,name', |
50 | 50 | ]); |
51 | 51 | |
52 | - $site = Site::create(['name' => $request->name]); |
|
52 | + $site = Site::create([ 'name' => $request->name ]); |
|
53 | 53 | |
54 | 54 | return redirect()->route('site.show', $site->id) |
55 | 55 | ->with('success', 'Site created successfully'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $locations = $site->locations()->orderBy('name', 'ASC')->paginate(15); |
68 | 68 | |
69 | 69 | if (\Request::ajax()) |
70 | - return response()->json(['site' => $site, 'locations' => $locations]); |
|
70 | + return response()->json([ 'site' => $site, 'locations' => $locations ]); |
|
71 | 71 | else |
72 | 72 | return view('site.show', [ 'site' => $site, 'locations' => $locations ]); |
73 | 73 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'name' => 'required|min:2|max:190|name|unique:sites,name,'.$site->id, |
99 | 99 | ]); |
100 | 100 | |
101 | - $site->update(['name' => $request->name]); |
|
101 | + $site->update([ 'name' => $request->name ]); |
|
102 | 102 | |
103 | 103 | return redirect()->route('site.show', $site->id) |
104 | 104 | ->with('success', 'Site updated successfully'); |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | { |
115 | 115 | Site::findOrFail($id)->delete(); |
116 | 116 | return redirect()->route('site.index') |
117 | - ->with('success','Site deleted successfully'); |
|
117 | + ->with('success', 'Site deleted successfully'); |
|
118 | 118 | } |
119 | 119 | } |