@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | -use App\Brand_Model; |
|
6 | 5 | use Illuminate\Http\Request; |
7 | 6 | |
8 | 7 | class Brand_ModelController extends Controller |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $brand_models = Brand_model::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/brand_model/index', ['brand_models' => $brand_models]); |
|
24 | + return view('manteniments/brand_model/index', [ 'brand_models' => $brand_models ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Brand_model::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'description' => $request['description'], |
|
48 | + 'name' => $request[ 'name' ], |
|
49 | + 'description' => $request[ 'description' ], |
|
50 | 50 | ]); |
51 | 51 | |
52 | 52 | return redirect()->intended('mnt/brand_model'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return redirect()->intended('/mnt/brand_model'); |
80 | 80 | } |
81 | 81 | |
82 | - return view('manteniments/brand_model/edit', ['brand_model' => $brand_model]); |
|
82 | + return view('manteniments/brand_model/edit', [ 'brand_model' => $brand_model ]); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $brand_model = Brand_model::findOrFail($id); |
96 | 96 | $input = [ |
97 | - 'name' => $request['name'], |
|
98 | - 'description' => $request['description'], |
|
97 | + 'name' => $request[ 'name' ], |
|
98 | + 'description' => $request[ 'description' ], |
|
99 | 99 | ]; |
100 | 100 | $this->validate($request, [ |
101 | 101 | 'name' => 'required|max:60', |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | public function search(Request $request) |
124 | 124 | { |
125 | 125 | $constraints = [ |
126 | - 'name' => $request['name'], |
|
126 | + 'name' => $request[ 'name' ], |
|
127 | 127 | ]; |
128 | 128 | $brand_models = $this->doSearchingQuery($constraints); |
129 | 129 | |
130 | - return view('manteniments/brand_model/index', ['brand_models' => $brand_models, 'searchingVals' => $constraints]); |
|
130 | + return view('manteniments/brand_model/index', [ 'brand_models' => $brand_models, 'searchingVals' => $constraints ]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | private function doSearchingQuery($constraints) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $index = 0; |
138 | 138 | foreach ($constraints as $constraint) { |
139 | 139 | if ($constraint != null) { |
140 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
140 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
141 | 141 | } |
142 | 142 | $index++; |
143 | 143 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use App\Inventory; |
6 | -use Auth; |
|
7 | 6 | use Excel; |
8 | 7 | use Illuminate\Http\Request; |
9 | 8 | use Illuminate\Support\Facades\DB; |
@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'provider.name as provider_name', 'provider.id as provider_id') |
49 | 49 | ->paginate(); |
50 | 50 | |
51 | - return view('/export/index', ['inventories' =>$inventories, 'searchingVals' => $constraints]); |
|
51 | + return view('/export/index', [ 'inventories' =>$inventories, 'searchingVals' => $constraints ]); |
|
52 | 52 | |
53 | 53 | //$inventories = $this->getItemsInventory($constraints); |
54 | 54 | //return view('/export/index', ['inventories' =>$inventories, 'searchingVals' => $constraints]); |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | public function exportPDF(Request $request) |
71 | 71 | { |
72 | 72 | $constraints = [ |
73 | - 'from' => $request['from'], |
|
74 | - 'to' => $request['to'], |
|
73 | + 'from' => $request[ 'from' ], |
|
74 | + 'to' => $request[ 'to' ], |
|
75 | 75 | ]; |
76 | 76 | $inventories = $this->getExportingData($constraints); |
77 | - $pdf = PDF::loadView('export/exportpdf', ['inventories' => $inventories, 'searchingVals' => $constraints])->setPaper('a4', 'landscape'); |
|
77 | + $pdf = PDF::loadView('export/exportpdf', [ 'inventories' => $inventories, 'searchingVals' => $constraints ])->setPaper('a4', 'landscape'); |
|
78 | 78 | |
79 | - return $pdf->download('Exportat_desde_'.$request['from'].'_a_'.$request['to'].'.pdf'); |
|
79 | + return $pdf->download('Exportat_desde_' . $request[ 'from' ] . '_a_' . $request[ 'to' ] . '.pdf'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | private function prepareExportingData($request) |
83 | 83 | { |
84 | - $inventories = $this->getExportingData(['from'=> $request['from'], 'to' => $request['to']]); |
|
84 | + $inventories = $this->getExportingData([ 'from'=> $request[ 'from' ], 'to' => $request[ 'to' ] ]); |
|
85 | 85 | |
86 | - return Excel::create('Exportat_desde_'.$request['from'].'_a_'.$request['to'], function ($excel) use ($inventories, $request) { |
|
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 | 90 | // Call them separately |
91 | 91 | $excel->setDescription('Llista'); |
92 | - $excel->sheet('Items', function ($sheet) use ($inventories) { |
|
92 | + $excel->sheet('Items', function($sheet) use ($inventories) { |
|
93 | 93 | $sheet->fromArray($inventories); |
94 | 94 | }); |
95 | 95 | }); |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | public function search(Request $request) |
99 | 99 | { |
100 | 100 | $constraints = [ |
101 | - 'from' => $request['from'], |
|
102 | - 'to' => $request['to'], |
|
101 | + 'from' => $request[ 'from' ], |
|
102 | + 'to' => $request[ 'to' ], |
|
103 | 103 | ]; |
104 | 104 | $inventories = $this->getItemsInventory($constraints); |
105 | 105 | |
106 | - return view('export/index', ['inventories' => $inventories, 'searchingVals' => $constraints]); |
|
106 | + return view('export/index', [ 'inventories' => $inventories, 'searchingVals' => $constraints ]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | private function getItemsInventory($constraints) |
110 | 110 | { |
111 | - $inventories = Inventory::where('date_entrance', '>=', $constraints['from']) |
|
112 | - ->where('date_entrance', '<=', $constraints['to']) |
|
111 | + $inventories = Inventory::where('date_entrance', '>=', $constraints[ 'from' ]) |
|
112 | + ->where('date_entrance', '<=', $constraints[ 'to' ]) |
|
113 | 113 | ->get(); |
114 | 114 | |
115 | 115 | return $inventories; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 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 | 129 | |
130 | 130 | ->get() |
131 | - ->map(function ($item, $key) { |
|
131 | + ->map(function($item, $key) { |
|
132 | 132 | return (array) $item; |
133 | 133 | }) |
134 | 134 | ->all(); |
@@ -218,6 +218,9 @@ |
||
218 | 218 | ]); |
219 | 219 | } |
220 | 220 | |
221 | + /** |
|
222 | + * @param string[] $keys |
|
223 | + */ |
|
221 | 224 | private function createQueryInput($keys, $request) |
222 | 225 | { |
223 | 226 | $queryInput = []; |
@@ -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 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'provider.name as provider_name', 'provider.id as provider_id') |
44 | 44 | ->paginate(5); |
45 | 45 | |
46 | - return view('inventory/index', ['inventories' => $inventories]); |
|
46 | + return view('inventory/index', [ 'inventories' => $inventories ]); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $locations = Location::all(); |
61 | 61 | $providers = Provider::all(); |
62 | 62 | |
63 | - return view('inventory/create', ['material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
63 | + return view('inventory/create', [ 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
64 | 64 | 'moneySources' => $moneySources, 'locations' => $locations, 'providers' => $providers, ]); |
65 | 65 | } |
66 | 66 | |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | $this->validateInput($request); |
77 | 77 | // Upload image |
78 | 78 | $path = $request->file('picture')->store('avatars'); |
79 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
79 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
80 | 80 | 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
81 | 81 | $input = $this->createQueryInput($keys, $request); |
82 | - $input['picture'] = $path; |
|
82 | + $input[ 'picture' ] = $path; |
|
83 | 83 | |
84 | 84 | Inventory::create($input); |
85 | 85 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $locations = Location::all(); |
121 | 121 | $providers = Provider::all(); |
122 | 122 | |
123 | - return view('inventory/edit', ['inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, 'moneySources' => $moneySources, |
|
123 | + return view('inventory/edit', [ 'inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, 'moneySources' => $moneySources, |
|
124 | 124 | 'locations' => $locations, 'providers' => $providers, ]); |
125 | 125 | } |
126 | 126 | |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | $inventory = Inventory::findOrFail($id); |
138 | 138 | $this->validateInput($request); |
139 | 139 | // Upload image |
140 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
140 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
141 | 141 | 'price', 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
142 | 142 | $input = $this->createQueryInput($keys, $request); |
143 | 143 | if ($request->file('picture')) { |
144 | 144 | $path = $request->file('picture')->store('public'); |
145 | - $input['picture'] = $path; |
|
145 | + $input[ 'picture' ] = $path; |
|
146 | 146 | } |
147 | 147 | Inventory::where('id', $id) |
148 | 148 | ->update($input); |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | public function search(Request $request) |
175 | 175 | { |
176 | 176 | $constraints = [ |
177 | - 'name' => $request['name'], |
|
177 | + 'name' => $request[ 'name' ], |
|
178 | 178 | ]; |
179 | 179 | $inventories = $this->doSearchingQuery($constraints); |
180 | 180 | |
181 | - return view('inventory/index', ['inventories' => $inventories, 'searchingVals' => $constraints]); |
|
181 | + return view('inventory/index', [ 'inventories' => $inventories, 'searchingVals' => $constraints ]); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | private function doSearchingQuery($constraints) |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $index = 0; |
189 | 189 | foreach ($constraints as $constraint) { |
190 | 190 | if ($constraint != null) { |
191 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
191 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
192 | 192 | } |
193 | 193 | $index++; |
194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function load($name) |
207 | 207 | { |
208 | - $path = storage_path().'/app/public/'.$name; |
|
208 | + $path = storage_path() . '/app/public/' . $name; |
|
209 | 209 | if (file_exists($path)) { |
210 | 210 | return Response::download($path); |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | |
221 | 221 | private function createQueryInput($keys, $request) |
222 | 222 | { |
223 | - $queryInput = []; |
|
223 | + $queryInput = [ ]; |
|
224 | 224 | for ($i = 0; $i < count($keys); $i++) { |
225 | - $key = $keys[$i]; |
|
226 | - $queryInput[$key] = $request[$key]; |
|
225 | + $key = $keys[ $i ]; |
|
226 | + $queryInput[ $key ] = $request[ $key ]; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | return $queryInput; |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | -use App\Material_Type; |
|
6 | 5 | use Illuminate\Http\Request; |
7 | 6 | |
8 | 7 | class Material_TypeController extends Controller |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $material_types = Material_type::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/material_type/index', ['material_types' => $material_types]); |
|
24 | + return view('manteniments/material_type/index', [ 'material_types' => $material_types ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Material_type::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'description' => $request['description'], |
|
48 | + 'name' => $request[ 'name' ], |
|
49 | + 'description' => $request[ 'description' ], |
|
50 | 50 | ]); |
51 | 51 | |
52 | 52 | return redirect()->intended('mnt/material_type'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return redirect()->intended('/mnt/material_type'); |
80 | 80 | } |
81 | 81 | |
82 | - return view('manteniments/material_type/edit', ['material_type' => $material_type]); |
|
82 | + return view('manteniments/material_type/edit', [ 'material_type' => $material_type ]); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $material_type = Material_type::findOrFail($id); |
96 | 96 | $input = [ |
97 | - 'name' => $request['name'], |
|
98 | - 'description' => $request['description'], |
|
97 | + 'name' => $request[ 'name' ], |
|
98 | + 'description' => $request[ 'description' ], |
|
99 | 99 | ]; |
100 | 100 | $this->validate($request, [ |
101 | 101 | 'name' => 'required|max:60', |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | public function search(Request $request) |
124 | 124 | { |
125 | 125 | $constraints = [ |
126 | - 'name' => $request['name'], |
|
126 | + 'name' => $request[ 'name' ], |
|
127 | 127 | ]; |
128 | 128 | $material_types = $this->doSearchingQuery($constraints); |
129 | 129 | |
130 | - return view('manteniments/material_type/index', ['material_types' => $material_types, 'searchingVals' => $constraints]); |
|
130 | + return view('manteniments/material_type/index', [ 'material_types' => $material_types, 'searchingVals' => $constraints ]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | private function doSearchingQuery($constraints) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $index = 0; |
138 | 138 | foreach ($constraints as $constraint) { |
139 | 139 | if ($constraint != null) { |
140 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
140 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
141 | 141 | } |
142 | 142 | $index++; |
143 | 143 | } |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $brands = Brand::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/brand/index', ['brands' => $brands]); |
|
24 | + return view('manteniments/brand/index', [ 'brands' => $brands ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,11 +45,11 @@ 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'], |
|
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 | 53 | ]); |
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/brand'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return redirect()->intended('/mnt/brand'); |
83 | 83 | } |
84 | 84 | |
85 | - return view('manteniments/brand/edit', ['brand' => $brand]); |
|
85 | + return view('manteniments/brand/edit', [ 'brand' => $brand ]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | { |
98 | 98 | $brand = Brand::findOrFail($id); |
99 | 99 | $input = [ |
100 | - 'name' => $request['name'], |
|
101 | - 'shortName' => $request['shortName'], |
|
102 | - 'description' => $request['description'], |
|
103 | - 'date_entrance' => $request['date_entrance'], |
|
104 | - 'last_update' => $request['last_update'], |
|
100 | + 'name' => $request[ 'name' ], |
|
101 | + 'shortName' => $request[ 'shortName' ], |
|
102 | + 'description' => $request[ 'description' ], |
|
103 | + 'date_entrance' => $request[ 'date_entrance' ], |
|
104 | + 'last_update' => $request[ 'last_update' ], |
|
105 | 105 | ]; |
106 | 106 | $this->validate($request, [ |
107 | 107 | 'name' => 'required|max:60', |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | public function search(Request $request) |
130 | 130 | { |
131 | 131 | $constraints = [ |
132 | - 'name' => $request['name'], |
|
133 | - 'shortName' => $request['shortName'], |
|
132 | + 'name' => $request[ 'name' ], |
|
133 | + 'shortName' => $request[ 'shortName' ], |
|
134 | 134 | ]; |
135 | 135 | $brands = $this->doSearchingQuery($constraints); |
136 | 136 | |
137 | - return view('manteniments/brand/index', ['brands' => $brands, 'searchingVals' => $constraints]); |
|
137 | + return view('manteniments/brand/index', [ 'brands' => $brands, 'searchingVals' => $constraints ]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function doSearchingQuery($constraints) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $index = 0; |
145 | 145 | foreach ($constraints as $constraint) { |
146 | 146 | if ($constraint != null) { |
147 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
147 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
148 | 148 | } |
149 | 149 | $index++; |
150 | 150 | } |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $providers = Provider::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/providers/index', ['providers' => $providers]); |
|
24 | + return view('manteniments/providers/index', [ 'providers' => $providers ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,11 +45,11 @@ 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'], |
|
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 | 53 | ]); |
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/provider'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return redirect()->intended('/mnt/provider'); |
83 | 83 | } |
84 | 84 | |
85 | - return view('manteniments/providers/edit', ['provider' => $provider]); |
|
85 | + return view('manteniments/providers/edit', [ 'provider' => $provider ]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | { |
98 | 98 | $provider = Provider::findOrFail($id); |
99 | 99 | $input = [ |
100 | - 'name' => $request['name'], |
|
101 | - 'shortName' => $request['shortName'], |
|
102 | - 'description' => $request['description'], |
|
103 | - 'date_entrance' => $request['date_entrance'], |
|
104 | - 'last_update' => $request['last_update'], |
|
100 | + 'name' => $request[ 'name' ], |
|
101 | + 'shortName' => $request[ 'shortName' ], |
|
102 | + 'description' => $request[ 'description' ], |
|
103 | + 'date_entrance' => $request[ 'date_entrance' ], |
|
104 | + 'last_update' => $request[ 'last_update' ], |
|
105 | 105 | ]; |
106 | 106 | $this->validate($request, [ |
107 | 107 | 'name' => 'required|max:60', |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | public function search(Request $request) |
130 | 130 | { |
131 | 131 | $constraints = [ |
132 | - 'name' => $request['name'], |
|
133 | - 'shortName' => $request['shortName'], |
|
132 | + 'name' => $request[ 'name' ], |
|
133 | + 'shortName' => $request[ 'shortName' ], |
|
134 | 134 | ]; |
135 | 135 | $providers = $this->doSearchingQuery($constraints); |
136 | 136 | |
137 | - return view('manteniments/providers/index', ['providers' => $providers, 'searchingVals' => $constraints]); |
|
137 | + return view('manteniments/providers/index', [ 'providers' => $providers, 'searchingVals' => $constraints ]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function doSearchingQuery($constraints) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $index = 0; |
145 | 145 | foreach ($constraints as $constraint) { |
146 | 146 | if ($constraint != null) { |
147 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
147 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
148 | 148 | } |
149 | 149 | $index++; |
150 | 150 | } |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $moneySources = MoneySource::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/moneySource/index', ['moneySources' => $moneySources]); |
|
24 | + return view('manteniments/moneySource/index', [ 'moneySources' => $moneySources ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,11 +45,11 @@ 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'], |
|
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 | 53 | ]); |
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/moneySource'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return redirect()->intended('/mnt/moneySource'); |
83 | 83 | } |
84 | 84 | |
85 | - return view('manteniments/moneySource/edit', ['moneySource' => $moneySource]); |
|
85 | + return view('manteniments/moneySource/edit', [ 'moneySource' => $moneySource ]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | { |
98 | 98 | $moneySource = MoneySource::findOrFail($id); |
99 | 99 | $input = [ |
100 | - 'name' => $request['name'], |
|
101 | - 'shortName' => $request['shortName'], |
|
102 | - 'description' => $request['description'], |
|
103 | - 'date_entrance' => $request['date_entrance'], |
|
104 | - 'last_update' => $request['last_update'], |
|
100 | + 'name' => $request[ 'name' ], |
|
101 | + 'shortName' => $request[ 'shortName' ], |
|
102 | + 'description' => $request[ 'description' ], |
|
103 | + 'date_entrance' => $request[ 'date_entrance' ], |
|
104 | + 'last_update' => $request[ 'last_update' ], |
|
105 | 105 | ]; |
106 | 106 | $this->validate($request, [ |
107 | 107 | 'name' => 'required|max:60', |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | public function search(Request $request) |
130 | 130 | { |
131 | 131 | $constraints = [ |
132 | - 'name' => $request['name'], |
|
133 | - 'shortName' => $request['shortName'], |
|
132 | + 'name' => $request[ 'name' ], |
|
133 | + 'shortName' => $request[ 'shortName' ], |
|
134 | 134 | ]; |
135 | 135 | $moneySources = $this->doSearchingQuery($constraints); |
136 | 136 | |
137 | - return view('manteniments/moneySource/index', ['moneySources' => $moneySources, 'searchingVals' => $constraints]); |
|
137 | + return view('manteniments/moneySource/index', [ 'moneySources' => $moneySources, 'searchingVals' => $constraints ]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function doSearchingQuery($constraints) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $index = 0; |
145 | 145 | foreach ($constraints as $constraint) { |
146 | 146 | if ($constraint != null) { |
147 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
147 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
148 | 148 | } |
149 | 149 | $index++; |
150 | 150 | } |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $locations = Location::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/location/index', ['locations' => $locations]); |
|
24 | + return view('manteniments/location/index', [ 'locations' => $locations ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,11 +45,11 @@ 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'], |
|
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 | 53 | ]); |
54 | 54 | |
55 | 55 | return redirect()->intended('mnt/location'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return redirect()->intended('/mnt/location'); |
83 | 83 | } |
84 | 84 | |
85 | - return view('manteniments/location/edit', ['location' => $location]); |
|
85 | + return view('manteniments/location/edit', [ 'location' => $location ]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | { |
98 | 98 | $location = Location::findOrFail($id); |
99 | 99 | $input = [ |
100 | - 'name' => $request['name'], |
|
101 | - 'shortName' => $request['shortName'], |
|
102 | - 'description' => $request['description'], |
|
103 | - 'date_entrance' => $request['date_entrance'], |
|
104 | - 'last_update' => $request['last_update'], |
|
100 | + 'name' => $request[ 'name' ], |
|
101 | + 'shortName' => $request[ 'shortName' ], |
|
102 | + 'description' => $request[ 'description' ], |
|
103 | + 'date_entrance' => $request[ 'date_entrance' ], |
|
104 | + 'last_update' => $request[ 'last_update' ], |
|
105 | 105 | ]; |
106 | 106 | $this->validate($request, [ |
107 | 107 | 'name' => 'required|max:60', |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | public function search(Request $request) |
130 | 130 | { |
131 | 131 | $constraints = [ |
132 | - 'name' => $request['name'], |
|
133 | - 'shortName' => $request['shortName'], |
|
132 | + 'name' => $request[ 'name' ], |
|
133 | + 'shortName' => $request[ 'shortName' ], |
|
134 | 134 | ]; |
135 | 135 | $locations = $this->doSearchingQuery($constraints); |
136 | 136 | |
137 | - return view('manteniments/location/index', ['locations' => $locations, 'searchingVals' => $constraints]); |
|
137 | + return view('manteniments/location/index', [ 'locations' => $locations, 'searchingVals' => $constraints ]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function doSearchingQuery($constraints) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $index = 0; |
145 | 145 | foreach ($constraints as $constraint) { |
146 | 146 | if ($constraint != null) { |
147 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
147 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
148 | 148 | } |
149 | 149 | $index++; |
150 | 150 | } |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | -use App\Brand_Model; |
|
6 | 5 | use Illuminate\Http\Request; |
7 | 6 | |
8 | 7 | class Brand_ModelController extends Controller |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $brand_models = Brand_model::paginate(5); |
23 | 23 | |
24 | - return view('manteniments/brand_model/index', ['brand_models' => $brand_models]); |
|
24 | + return view('manteniments/brand_model/index', [ 'brand_models' => $brand_models ]); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->validateInput($request); |
47 | 47 | Brand_model::create([ |
48 | - 'name' => $request['name'], |
|
49 | - 'description' => $request['description'], |
|
48 | + 'name' => $request[ 'name' ], |
|
49 | + 'description' => $request[ 'description' ], |
|
50 | 50 | ]); |
51 | 51 | |
52 | 52 | return redirect()->intended('mnt/brand_model'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return redirect()->intended('/mnt/brand_model'); |
80 | 80 | } |
81 | 81 | |
82 | - return view('manteniments/brand_model/edit', ['brand_model' => $brand_model]); |
|
82 | + return view('manteniments/brand_model/edit', [ 'brand_model' => $brand_model ]); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $brand_model = Brand_model::findOrFail($id); |
96 | 96 | $input = [ |
97 | - 'name' => $request['name'], |
|
98 | - 'description' => $request['description'], |
|
97 | + 'name' => $request[ 'name' ], |
|
98 | + 'description' => $request[ 'description' ], |
|
99 | 99 | ]; |
100 | 100 | $this->validate($request, [ |
101 | 101 | 'name' => 'required|max:60', |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | public function search(Request $request) |
124 | 124 | { |
125 | 125 | $constraints = [ |
126 | - 'name' => $request['name'], |
|
126 | + 'name' => $request[ 'name' ], |
|
127 | 127 | ]; |
128 | 128 | $brand_models = $this->doSearchingQuery($constraints); |
129 | 129 | |
130 | - return view('manteniments/brand_model/index', ['brand_models' => $brand_models, 'searchingVals' => $constraints]); |
|
130 | + return view('manteniments/brand_model/index', [ 'brand_models' => $brand_models, 'searchingVals' => $constraints ]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | private function doSearchingQuery($constraints) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $index = 0; |
138 | 138 | foreach ($constraints as $constraint) { |
139 | 139 | if ($constraint != null) { |
140 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
140 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
141 | 141 | } |
142 | 142 | $index++; |
143 | 143 | } |