@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class Brand_ModelController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Brand_model::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'description' => $request['description'], |
|
50 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'description' => $request['description'], |
|
50 | + ]); |
|
51 | 51 | |
52 | 52 | return redirect()->intended('mnt/brand_model'); |
53 | 53 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | public function edit($id) |
75 | 75 | { |
76 | 76 | $brand_model = Brand_model::find($id); |
77 | - // Redirect to country list if updating country wasn't existed |
|
78 | - if ($brand_model == null || count($brand_model) == 0) { |
|
79 | - return redirect()->intended('/mnt/brand_model'); |
|
80 | - } |
|
77 | + // Redirect to country list if updating country wasn't existed |
|
78 | + if ($brand_model == null || count($brand_model) == 0) { |
|
79 | + return redirect()->intended('/mnt/brand_model'); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | return view('manteniments/brand_model/edit', ['brand_model' => $brand_model]); |
83 | 83 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | $input = [ |
97 | 97 | 'name' => $request['name'], |
98 | 98 | 'description' => $request['description'], |
99 | - ]; |
|
99 | + ]; |
|
100 | 100 | $this->validate($request, [ |
101 | - 'name' => 'required|max:60', |
|
102 | - ]); |
|
101 | + 'name' => 'required|max:60', |
|
102 | + ]); |
|
103 | 103 | Brand_model::where('id', $id) |
104 | - ->update($input); |
|
104 | + ->update($input); |
|
105 | 105 | |
106 | 106 | return redirect()->intended('mnt/brand_model'); |
107 | 107 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class BrandController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Brand::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'shortName' => $request['shortName'], |
|
50 | - 'description' => $request['description'], |
|
51 | - 'date_entrance' => $request['date_entrance'], |
|
52 | - 'last_update' => $request['last_update'], |
|
53 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'shortName' => $request['shortName'], |
|
50 | + 'description' => $request['description'], |
|
51 | + 'date_entrance' => $request['date_entrance'], |
|
52 | + 'last_update' => $request['last_update'], |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/brand'); |
56 | 56 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function edit($id) |
78 | 78 | { |
79 | 79 | $brand = Brand::find($id); |
80 | - // Redirect to country list if updating country wasn't existed |
|
81 | - if ($brand == null || count($brand) == 0) { |
|
82 | - return redirect()->intended('/mnt/brand'); |
|
83 | - } |
|
80 | + // Redirect to country list if updating country wasn't existed |
|
81 | + if ($brand == null || count($brand) == 0) { |
|
82 | + return redirect()->intended('/mnt/brand'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | return view('manteniments/brand/edit', ['brand' => $brand]); |
86 | 86 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'description' => $request['description'], |
103 | 103 | 'date_entrance' => $request['date_entrance'], |
104 | 104 | 'last_update' => $request['last_update'], |
105 | - ]; |
|
105 | + ]; |
|
106 | 106 | $this->validate($request, [ |
107 | - 'name' => 'required|max:60', |
|
108 | - ]); |
|
107 | + 'name' => 'required|max:60', |
|
108 | + ]); |
|
109 | 109 | Brand::where('id', $id) |
110 | - ->update($input); |
|
110 | + ->update($input); |
|
111 | 111 | |
112 | 112 | return redirect()->intended('mnt/brand'); |
113 | 113 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $providers = Provider::all(); |
62 | 62 | |
63 | 63 | return view('inventory/create', ['material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
64 | - 'moneySources' => $moneySources, 'locations' => $locations, 'providers' => $providers, ]); |
|
64 | + 'moneySources' => $moneySources, 'locations' => $locations, 'providers' => $providers, ]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -196,20 +196,20 @@ discard block |
||
196 | 196 | return $query->paginate(5); |
197 | 197 | } |
198 | 198 | |
199 | - /** |
|
200 | - * Load image resource. |
|
201 | - * |
|
202 | - * @param string $name |
|
203 | - * |
|
204 | - * @return \Illuminate\Http\Response |
|
205 | - */ |
|
206 | - public function load($name) |
|
207 | - { |
|
208 | - $path = storage_path().'/app/public/'.$name; |
|
209 | - if (file_exists($path)) { |
|
210 | - return Response::download($path); |
|
211 | - } |
|
212 | - } |
|
199 | + /** |
|
200 | + * Load image resource. |
|
201 | + * |
|
202 | + * @param string $name |
|
203 | + * |
|
204 | + * @return \Illuminate\Http\Response |
|
205 | + */ |
|
206 | + public function load($name) |
|
207 | + { |
|
208 | + $path = storage_path().'/app/public/'.$name; |
|
209 | + if (file_exists($path)) { |
|
210 | + return Response::download($path); |
|
211 | + } |
|
212 | + } |
|
213 | 213 | |
214 | 214 | private function validateInput($request) |
215 | 215 | { |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | $now = date($format); |
34 | 34 | $to = date($format, strtotime('+15 days')); |
35 | 35 | $constraints = [ |
36 | - 'from' => $now, |
|
37 | - 'to' => $to, |
|
36 | + 'from' => $now, |
|
37 | + 'to' => $to, |
|
38 | 38 | ]; |
39 | 39 | |
40 | 40 | $inventories = DB::table('inventories') |
@@ -54,25 +54,25 @@ discard block |
||
54 | 54 | //return view('/export/index', ['inventories' =>$inventories, 'searchingVals' => $constraints]); |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Store a newly created resource in storage. |
|
59 | - * |
|
60 | - * @param \Illuminate\Http\Request $request |
|
61 | - * |
|
62 | - * @return \Illuminate\Http\Response |
|
63 | - */ |
|
64 | - public function exportExcel(Request $request) |
|
65 | - { |
|
66 | - $this->prepareExportingData($request)->export('csv'); |
|
67 | - redirect()->intended('mnt-export'); |
|
68 | - } |
|
57 | + /** |
|
58 | + * Store a newly created resource in storage. |
|
59 | + * |
|
60 | + * @param \Illuminate\Http\Request $request |
|
61 | + * |
|
62 | + * @return \Illuminate\Http\Response |
|
63 | + */ |
|
64 | + public function exportExcel(Request $request) |
|
65 | + { |
|
66 | + $this->prepareExportingData($request)->export('csv'); |
|
67 | + redirect()->intended('mnt-export'); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | public function exportPDF(Request $request) |
71 | 71 | { |
72 | 72 | $constraints = [ |
73 | - 'from' => $request['from'], |
|
74 | - 'to' => $request['to'], |
|
75 | - ]; |
|
73 | + 'from' => $request['from'], |
|
74 | + 'to' => $request['to'], |
|
75 | + ]; |
|
76 | 76 | $inventories = $this->getExportingData($constraints); |
77 | 77 | $pdf = PDF::loadView('export/exportpdf', ['inventories' => $inventories, 'searchingVals' => $constraints])->setPaper('a4', 'landscape'); |
78 | 78 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | return Excel::create('Exportat_desde_'.$request['from'].'_a_'.$request['to'], function ($excel) use ($inventories, $request) { |
87 | 87 | // Set the title |
88 | - $excel->setTitle('Inventari from '.$request['from'].' to '.$request['to']); |
|
88 | + $excel->setTitle('Inventari from '.$request['from'].' to '.$request['to']); |
|
89 | 89 | |
90 | - // Call them separately |
|
91 | - $excel->setDescription('Llista'); |
|
90 | + // Call them separately |
|
91 | + $excel->setDescription('Llista'); |
|
92 | 92 | $excel->sheet('Items', function ($sheet) use ($inventories) { |
93 | 93 | $sheet->fromArray($inventories); |
94 | 94 | }); |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | public function search(Request $request) |
99 | 99 | { |
100 | 100 | $constraints = [ |
101 | - 'from' => $request['from'], |
|
102 | - 'to' => $request['to'], |
|
103 | - ]; |
|
101 | + 'from' => $request['from'], |
|
102 | + 'to' => $request['to'], |
|
103 | + ]; |
|
104 | 104 | $inventories = $this->getItemsInventory($constraints); |
105 | 105 | |
106 | 106 | return view('export/index', ['inventories' => $inventories, 'searchingVals' => $constraints]); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | private function getItemsInventory($constraints) |
110 | 110 | { |
111 | 111 | $inventories = Inventory::where('date_entrance', '>=', $constraints['from']) |
112 | - ->where('date_entrance', '<=', $constraints['to']) |
|
113 | - ->get(); |
|
112 | + ->where('date_entrance', '<=', $constraints['to']) |
|
113 | + ->get(); |
|
114 | 114 | |
115 | 115 | return $inventories; |
116 | 116 | } |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | private function getExportingData($constraints) |
119 | 119 | { |
120 | 120 | return DB::table('inventories') |
121 | - ->leftJoin('brand', 'inventories.brand_id', '=', 'brand.id') |
|
122 | - ->leftJoin('material_type', 'inventories.material_type_id', '=', 'material_type.id') |
|
123 | - ->leftJoin('brand_model', 'inventories.model_id', '=', 'brand_model.id') |
|
124 | - ->leftJoin('moneySource', 'inventories.moneySourceId', '=', 'moneySource.id') |
|
125 | - ->leftJoin('location', 'inventories.location_id', '=', 'location.id') |
|
126 | - ->leftJoin('provider', 'inventories.provider_id', '=', 'provider.id') |
|
127 | - ->select('inventories.name as name', 'inventories.description as description', 'material_type.name as material_type_name', 'brand.name as brand_name', 'brand_model.name as brand_model_name', |
|
128 | - 'location.name as location_name', 'moneySource.name as moneySource_name', 'provider.name as provider_name', 'inventories.quantity as quantity', 'inventories.price as price', 'inventories.date_entrance as date_entrance', 'inventories.last_update as last_update') |
|
129 | - |
|
130 | - ->get() |
|
131 | - ->map(function ($item, $key) { |
|
132 | - return (array) $item; |
|
133 | - }) |
|
134 | - ->all(); |
|
121 | + ->leftJoin('brand', 'inventories.brand_id', '=', 'brand.id') |
|
122 | + ->leftJoin('material_type', 'inventories.material_type_id', '=', 'material_type.id') |
|
123 | + ->leftJoin('brand_model', 'inventories.model_id', '=', 'brand_model.id') |
|
124 | + ->leftJoin('moneySource', 'inventories.moneySourceId', '=', 'moneySource.id') |
|
125 | + ->leftJoin('location', 'inventories.location_id', '=', 'location.id') |
|
126 | + ->leftJoin('provider', 'inventories.provider_id', '=', 'provider.id') |
|
127 | + ->select('inventories.name as name', 'inventories.description as description', 'material_type.name as material_type_name', 'brand.name as brand_name', 'brand_model.name as brand_model_name', |
|
128 | + 'location.name as location_name', 'moneySource.name as moneySource_name', 'provider.name as provider_name', 'inventories.quantity as quantity', 'inventories.price as price', 'inventories.date_entrance as date_entrance', 'inventories.last_update as last_update') |
|
129 | + |
|
130 | + ->get() |
|
131 | + ->map(function ($item, $key) { |
|
132 | + return (array) $item; |
|
133 | + }) |
|
134 | + ->all(); |
|
135 | 135 | } |
136 | 136 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class ProviderController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Provider::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'shortName' => $request['shortName'], |
|
50 | - 'description' => $request['description'], |
|
51 | - 'date_entrance' => $request['date_entrance'], |
|
52 | - 'last_update' => $request['last_update'], |
|
53 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'shortName' => $request['shortName'], |
|
50 | + 'description' => $request['description'], |
|
51 | + 'date_entrance' => $request['date_entrance'], |
|
52 | + 'last_update' => $request['last_update'], |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/provider'); |
56 | 56 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function edit($id) |
78 | 78 | { |
79 | 79 | $provider = Provider::find($id); |
80 | - // Redirect to country list if updating country wasn't existed |
|
81 | - if ($provider == null || count($provider) == 0) { |
|
82 | - return redirect()->intended('/mnt/provider'); |
|
83 | - } |
|
80 | + // Redirect to country list if updating country wasn't existed |
|
81 | + if ($provider == null || count($provider) == 0) { |
|
82 | + return redirect()->intended('/mnt/provider'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | return view('manteniments/providers/edit', ['provider' => $provider]); |
86 | 86 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'description' => $request['description'], |
103 | 103 | 'date_entrance' => $request['date_entrance'], |
104 | 104 | 'last_update' => $request['last_update'], |
105 | - ]; |
|
105 | + ]; |
|
106 | 106 | $this->validate($request, [ |
107 | - 'name' => 'required|max:60', |
|
108 | - ]); |
|
107 | + 'name' => 'required|max:60', |
|
108 | + ]); |
|
109 | 109 | Provider::where('id', $id) |
110 | - ->update($input); |
|
110 | + ->update($input); |
|
111 | 111 | |
112 | 112 | return redirect()->intended('mnt/provider'); |
113 | 113 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class Material_TypeController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Material_type::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'description' => $request['description'], |
|
50 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'description' => $request['description'], |
|
50 | + ]); |
|
51 | 51 | |
52 | 52 | return redirect()->intended('mnt/material_type'); |
53 | 53 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | public function edit($id) |
75 | 75 | { |
76 | 76 | $material_type = Material_type::find($id); |
77 | - // Redirect to country list if updating country wasn't existed |
|
78 | - if ($material_type == null || count($material_type) == 0) { |
|
79 | - return redirect()->intended('/mnt/material_type'); |
|
80 | - } |
|
77 | + // Redirect to country list if updating country wasn't existed |
|
78 | + if ($material_type == null || count($material_type) == 0) { |
|
79 | + return redirect()->intended('/mnt/material_type'); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | return view('manteniments/material_type/edit', ['material_type' => $material_type]); |
83 | 83 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | $input = [ |
97 | 97 | 'name' => $request['name'], |
98 | 98 | 'description' => $request['description'], |
99 | - ]; |
|
99 | + ]; |
|
100 | 100 | $this->validate($request, [ |
101 | - 'name' => 'required|max:60', |
|
102 | - ]); |
|
101 | + 'name' => 'required|max:60', |
|
102 | + ]); |
|
103 | 103 | Material_type::where('id', $id) |
104 | - ->update($input); |
|
104 | + ->update($input); |
|
105 | 105 | |
106 | 106 | return redirect()->intended('mnt/material_type'); |
107 | 107 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class MoneySourceController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | MoneySource::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'shortName' => $request['shortName'], |
|
50 | - 'description' => $request['description'], |
|
51 | - 'date_entrance' => $request['date_entrance'], |
|
52 | - 'last_update' => $request['last_update'], |
|
53 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'shortName' => $request['shortName'], |
|
50 | + 'description' => $request['description'], |
|
51 | + 'date_entrance' => $request['date_entrance'], |
|
52 | + 'last_update' => $request['last_update'], |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/moneySource'); |
56 | 56 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function edit($id) |
78 | 78 | { |
79 | 79 | $moneySource = MoneySource::find($id); |
80 | - // Redirect to country list if updating country wasn't existed |
|
81 | - if ($moneySource == null || count($moneySource) == 0) { |
|
82 | - return redirect()->intended('/mnt/moneySource'); |
|
83 | - } |
|
80 | + // Redirect to country list if updating country wasn't existed |
|
81 | + if ($moneySource == null || count($moneySource) == 0) { |
|
82 | + return redirect()->intended('/mnt/moneySource'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | return view('manteniments/moneySource/edit', ['moneySource' => $moneySource]); |
86 | 86 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'description' => $request['description'], |
103 | 103 | 'date_entrance' => $request['date_entrance'], |
104 | 104 | 'last_update' => $request['last_update'], |
105 | - ]; |
|
105 | + ]; |
|
106 | 106 | $this->validate($request, [ |
107 | - 'name' => 'required|max:60', |
|
108 | - ]); |
|
107 | + 'name' => 'required|max:60', |
|
108 | + ]); |
|
109 | 109 | MoneySource::where('id', $id) |
110 | - ->update($input); |
|
110 | + ->update($input); |
|
111 | 111 | |
112 | 112 | return redirect()->intended('mnt/moneySource'); |
113 | 113 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class LocationController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Location::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'shortName' => $request['shortName'], |
|
50 | - 'description' => $request['description'], |
|
51 | - 'date_entrance' => $request['date_entrance'], |
|
52 | - 'last_update' => $request['last_update'], |
|
53 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'shortName' => $request['shortName'], |
|
50 | + 'description' => $request['description'], |
|
51 | + 'date_entrance' => $request['date_entrance'], |
|
52 | + 'last_update' => $request['last_update'], |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/location'); |
56 | 56 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function edit($id) |
78 | 78 | { |
79 | 79 | $location = Location::find($id); |
80 | - // Redirect to country list if updating country wasn't existed |
|
81 | - if ($location == null || count($location) == 0) { |
|
82 | - return redirect()->intended('/mnt/location'); |
|
83 | - } |
|
80 | + // Redirect to country list if updating country wasn't existed |
|
81 | + if ($location == null || count($location) == 0) { |
|
82 | + return redirect()->intended('/mnt/location'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | return view('manteniments/location/edit', ['location' => $location]); |
86 | 86 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'description' => $request['description'], |
103 | 103 | 'date_entrance' => $request['date_entrance'], |
104 | 104 | 'last_update' => $request['last_update'], |
105 | - ]; |
|
105 | + ]; |
|
106 | 106 | $this->validate($request, [ |
107 | - 'name' => 'required|max:60', |
|
108 | - ]); |
|
107 | + 'name' => 'required|max:60', |
|
108 | + ]); |
|
109 | 109 | Location::where('id', $id) |
110 | - ->update($input); |
|
110 | + ->update($input); |
|
111 | 111 | |
112 | 112 | return redirect()->intended('mnt/location'); |
113 | 113 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | class LocationController extends Controller |
9 | 9 | { |
10 | 10 | /** |
11 | - * Display a listing of the resource. |
|
12 | - * |
|
13 | - * @return \Illuminate\Http\Response |
|
14 | - */ |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->middleware('auth'); |
|
18 | - } |
|
11 | + * Display a listing of the resource. |
|
12 | + * |
|
13 | + * @return \Illuminate\Http\Response |
|
14 | + */ |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->middleware('auth'); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function index() |
21 | 21 | { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Location::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'shortName' => $request['shortName'], |
|
50 | - 'description' => $request['description'], |
|
51 | - 'date_entrance' => $request['date_entrance'], |
|
52 | - 'last_update' => $request['last_update'], |
|
53 | - ]); |
|
48 | + 'name' => $request['name'], |
|
49 | + 'shortName' => $request['shortName'], |
|
50 | + 'description' => $request['description'], |
|
51 | + 'date_entrance' => $request['date_entrance'], |
|
52 | + 'last_update' => $request['last_update'], |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/location'); |
56 | 56 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function edit($id) |
78 | 78 | { |
79 | 79 | $location = Location::find($id); |
80 | - // Redirect to country list if updating country wasn't existed |
|
81 | - if ($location == null || count($location) == 0) { |
|
82 | - return redirect()->intended('/mnt/location'); |
|
83 | - } |
|
80 | + // Redirect to country list if updating country wasn't existed |
|
81 | + if ($location == null || count($location) == 0) { |
|
82 | + return redirect()->intended('/mnt/location'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | return view('manteniments/location/edit', ['location' => $location]); |
86 | 86 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'description' => $request['description'], |
103 | 103 | 'date_entrance' => $request['date_entrance'], |
104 | 104 | 'last_update' => $request['last_update'], |
105 | - ]; |
|
105 | + ]; |
|
106 | 106 | $this->validate($request, [ |
107 | - 'name' => 'required|max:60', |
|
108 | - ]); |
|
107 | + 'name' => 'required|max:60', |
|
108 | + ]); |
|
109 | 109 | Location::where('id', $id) |
110 | - ->update($input); |
|
110 | + ->update($input); |
|
111 | 111 | |
112 | 112 | return redirect()->intended('mnt/location'); |
113 | 113 | } |