@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * Store a newly created resource in storage. |
| 42 | 42 | * |
| 43 | 43 | * @param \Illuminate\Http\Request $request |
| 44 | - * @return \Illuminate\Http\Response |
|
| 44 | + * @return \Illuminate\Http\RedirectResponse |
|
| 45 | 45 | */ |
| 46 | 46 | public function store(Request $request) |
| 47 | 47 | { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @param \Illuminate\Http\Request $request |
| 89 | 89 | * @param Site $site |
| 90 | - * @return \Illuminate\Http\Response |
|
| 90 | + * @return \Illuminate\Http\RedirectResponse |
|
| 91 | 91 | */ |
| 92 | 92 | public function update(Request $request, Site $site) |
| 93 | 93 | { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * Remove the specified resource from storage. |
| 106 | 106 | * |
| 107 | 107 | * @param int $id |
| 108 | - * @return \Illuminate\Http\Response |
|
| 108 | + * @return \Illuminate\Http\RedirectResponse |
|
| 109 | 109 | */ |
| 110 | 110 | public function destroy($id) |
| 111 | 111 | { |
@@ -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'); |
@@ -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:75|regex:#(^[a-zA-Z0-9])([\w ]*)(\w$)#|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 | } |
@@ -66,10 +66,11 @@ |
||
| 66 | 66 | $site = Site::findOrFail($id); |
| 67 | 67 | $locations = $site->locations()->orderBy('name', 'ASC')->paginate(15); |
| 68 | 68 | |
| 69 | - if (\Request::ajax()) |
|
| 70 | - return response()->json(['site' => $site, 'locations' => $locations]); |
|
| 71 | - else |
|
| 72 | - return view('site.show', [ 'site' => $site, 'locations' => $locations ]); |
|
| 69 | + if (\Request::ajax()) { |
|
| 70 | + return response()->json(['site' => $site, 'locations' => $locations]); |
|
| 71 | + } else { |
|
| 72 | + return view('site.show', [ 'site' => $site, 'locations' => $locations ]); |
|
| 73 | + } |
|
| 73 | 74 | } |
| 74 | 75 | |
| 75 | 76 | /** |