@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | if (!empty($request->input('new_site_name'))) |
| 53 | 53 | { |
| 54 | 54 | //Create a new site |
| 55 | - $site = Site::create(['name' => $request->input('new_site_name')]); |
|
| 55 | + $site = Site::create([ 'name' => $request->input('new_site_name') ]); |
|
| 56 | 56 | $site_id = $site->id; |
| 57 | 57 | } |
| 58 | 58 | else |
| 59 | 59 | $site_id = $request->input('site'); |
| 60 | 60 | |
| 61 | - $location = Location::create(['name' => $request->input('name'), 'site_id' => $site_id]); |
|
| 61 | + $location = Location::create([ 'name' => $request->input('name'), 'site_id' => $site_id ]); |
|
| 62 | 62 | |
| 63 | 63 | return redirect()->route('location.show', $location->id) |
| 64 | 64 | ->with('success', 'Location created successfully'); |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | if (!empty($request->input('new_site_name'))) |
| 106 | 106 | { |
| 107 | 107 | //Create a new site |
| 108 | - $site = Site::create(['name' => $request->input('new_site_name')]); |
|
| 108 | + $site = Site::create([ 'name' => $request->input('new_site_name') ]); |
|
| 109 | 109 | $site_id = $site->id; |
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | $site_id = $request->input('site'); |
| 113 | 113 | |
| 114 | 114 | //Update the location with the supplied name and the site |
| 115 | - Location::findOrFail($id)->update(['name' => $request->input('name'), 'site_id' => $site_id]); |
|
| 115 | + Location::findOrFail($id)->update([ 'name' => $request->input('name'), 'site_id' => $site_id ]); |
|
| 116 | 116 | |
| 117 | 117 | return redirect()->route('location.show', $id) |
| 118 | 118 | ->with('success', 'Location updated successfully'); |
@@ -128,6 +128,6 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | Location::findOrFail($id)->delete(); |
| 130 | 130 | return redirect()->route('location.index') |
| 131 | - ->with('success','Location deleted successfully'); |
|
| 131 | + ->with('success', 'Location deleted successfully'); |
|
| 132 | 132 | } |
| 133 | 133 | } |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $validator = parent::getValidatorInstance(); |
| 40 | 40 | |
| 41 | - $validator->sometimes('site', 'required|integer|digits_between:1,10|exists:sites,id', function ($input) { |
|
| 41 | + $validator->sometimes('site', 'required|integer|digits_between:1,10|exists:sites,id', function($input) { |
|
| 42 | 42 | return !$input->new_site_name; |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | - $validator->sometimes('new_site_name', 'bail|required|min:2|max:75|regex:#(^[a-zA-Z0-9])([\w ]*)(\w$)#|unique:sites,name', function ($input) { |
|
| 45 | + $validator->sometimes('new_site_name', 'bail|required|min:2|max:75|regex:#(^[a-zA-Z0-9])([\w ]*)(\w$)#|unique:sites,name', function($input) { |
|
| 46 | 46 | return !$input->site; |
| 47 | 47 | }); |
| 48 | 48 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'name' => 'required|min:2|max:75|regex:#(^[a-zA-Z0-9])([\w ]*)(\w$)#|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'); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'name' => 'required|min:2|max:75|regex:#(^[a-zA-Z0-9])([\w ]*)(\w$)#|unique:sites,name,'.$site->id, |
| 96 | 96 | ]); |
| 97 | 97 | |
| 98 | - $site->update(['name' => $request->name]); |
|
| 98 | + $site->update([ 'name' => $request->name ]); |
|
| 99 | 99 | |
| 100 | 100 | return redirect()->route('site.show', $site->id) |
| 101 | 101 | ->with('success', 'Site updated successfully'); |
@@ -111,6 +111,6 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | Site::findOrFail($id)->delete(); |
| 113 | 113 | return redirect()->route('site.index') |
| 114 | - ->with('success','Site deleted successfully'); |
|
| 114 | + ->with('success', 'Site deleted successfully'); |
|
| 115 | 115 | } |
| 116 | 116 | } |