@@ -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 | { |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | ->leftJoin('provider', 'inventories.provider_id', '=', 'provider.id') |
42 | 42 | ->select('inventories.*', 'material_type.name as material_type_name', 'material_type.id as material_type_id', 'brand.name as brand_name', 'brand.id as brand_id', |
43 | 43 | 'brand_model.name as brand_model_name', 'brand_model.id as model_id', 'location.name as location_name', 'location.id as location_id', |
44 | - 'moneySource.name as moneySource_name', 'moneySource.id as moneySourceId','provider.name as provider_name', 'provider.id as provider_id') |
|
44 | + 'moneySource.name as moneySource_name', 'moneySource.id as moneySourceId', 'provider.name as provider_name', 'provider.id as provider_id') |
|
45 | 45 | ->paginate(5); |
46 | 46 | |
47 | - return view('inventory/index', ['inventories' => $inventories]); |
|
47 | + return view('inventory/index', [ 'inventories' => $inventories ]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $locations = Location::all(); |
62 | 62 | $providers = Provider::all(); |
63 | 63 | |
64 | - return view('inventory/create', ['material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
64 | + return view('inventory/create', [ 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
65 | 65 | 'moneySources' => $moneySources, 'locations' => $locations, 'providers' => $providers, ]); |
66 | 66 | } |
67 | 67 | |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $this->validateInput($request); |
78 | 78 | // Upload image |
79 | 79 | $path = $request->file('picture')->store('avatars'); |
80 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
80 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
81 | 81 | 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
82 | 82 | $input = $this->createQueryInput($keys, $request); |
83 | - $input['picture'] = $path; |
|
83 | + $input[ 'picture' ] = $path; |
|
84 | 84 | |
85 | 85 | Inventory::create($input); |
86 | 86 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $locations = Location::all(); |
122 | 122 | $providers = Provider::all(); |
123 | 123 | |
124 | - return view('inventory/edit', ['inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
125 | - 'moneySources' => $moneySources,'locations'=> $locations, 'providers' => $providers, ]); |
|
124 | + return view('inventory/edit', [ 'inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
125 | + 'moneySources' => $moneySources, 'locations'=> $locations, 'providers' => $providers, ]); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | $inventory = Inventory::findOrFail($id); |
139 | 139 | $this->validateInput($request); |
140 | 140 | // Upload image |
141 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
141 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
142 | 142 | 'price', 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
143 | 143 | $input = $this->createQueryInput($keys, $request); |
144 | 144 | if ($request->file('picture')) { |
145 | 145 | $path = $request->file('picture')->store('public'); |
146 | - $input['picture'] = $path; |
|
146 | + $input[ 'picture' ] = $path; |
|
147 | 147 | } |
148 | 148 | Inventory::where('id', $id) |
149 | 149 | ->update($input); |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | public function search(Request $request) |
176 | 176 | { |
177 | 177 | $constraints = [ |
178 | - 'name' => $request['name'], |
|
178 | + 'name' => $request[ 'name' ], |
|
179 | 179 | ]; |
180 | 180 | $inventories = $this->doSearchingQuery($constraints); |
181 | 181 | |
182 | - return view('inventory/index', ['inventories' => $inventories, 'searchingVals' => $constraints]); |
|
182 | + return view('inventory/index', [ 'inventories' => $inventories, 'searchingVals' => $constraints ]); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | private function doSearchingQuery($constraints) |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $index = 0; |
190 | 190 | foreach ($constraints as $constraint) { |
191 | 191 | if ($constraint != null) { |
192 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
192 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
193 | 193 | } |
194 | 194 | $index++; |
195 | 195 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function load($name) |
208 | 208 | { |
209 | - $path = storage_path().'/app/public/'.$name; |
|
209 | + $path = storage_path() . '/app/public/' . $name; |
|
210 | 210 | if (file_exists($path)) { |
211 | 211 | return Response::download($path); |
212 | 212 | } |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | |
234 | 234 | private function createQueryInput($keys, $request) |
235 | 235 | { |
236 | - $queryInput = []; |
|
236 | + $queryInput = [ ]; |
|
237 | 237 | for ($i = 0; $i < count($keys); $i++) { |
238 | - $key = $keys[$i]; |
|
239 | - $queryInput[$key] = $request[$key]; |
|
238 | + $key = $keys[ $i ]; |
|
239 | + $queryInput[ $key ] = $request[ $key ]; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | 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 | } |
@@ -11,68 +11,68 @@ discard block |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::get('/', function () { |
|
14 | +Route::get('/', function() { |
|
15 | 15 | return view('welcome'); |
16 | 16 | }); |
17 | 17 | |
18 | -Route::get('/inventory', function () { |
|
18 | +Route::get('/inventory', function() { |
|
19 | 19 | return view('inventory'); |
20 | 20 | }); |
21 | 21 | |
22 | -Route::get('/manteniments', function () { |
|
22 | +Route::get('/manteniments', function() { |
|
23 | 23 | return view('manteniments'); |
24 | 24 | }); |
25 | 25 | |
26 | -Route::get('/providers', function () { |
|
26 | +Route::get('/providers', function() { |
|
27 | 27 | return view('providers'); |
28 | 28 | }); |
29 | 29 | |
30 | -Route::get('/location', function () { |
|
30 | +Route::get('/location', function() { |
|
31 | 31 | return view('location'); |
32 | 32 | }); |
33 | 33 | |
34 | -Route::get('/material-type', function () { |
|
34 | +Route::get('/material-type', function() { |
|
35 | 35 | return view('material-type'); |
36 | 36 | }); |
37 | 37 | |
38 | -Route::get('/brand-model', function () { |
|
38 | +Route::get('/brand-model', function() { |
|
39 | 39 | return view('brand-model'); |
40 | 40 | }); |
41 | 41 | |
42 | -Route::get('/brand', function () { |
|
42 | +Route::get('/brand', function() { |
|
43 | 43 | return view('brand'); |
44 | 44 | }); |
45 | 45 | |
46 | -Route::get('/vue', function () { |
|
46 | +Route::get('/vue', function() { |
|
47 | 47 | return view('vue'); |
48 | 48 | }); |
49 | 49 | |
50 | 50 | Route::resource('inventory', 'InventoryController'); |
51 | 51 | |
52 | -Route::get('foo', function () { |
|
52 | +Route::get('foo', function() { |
|
53 | 53 | return 'Hello World'; |
54 | 54 | }); |
55 | 55 | |
56 | -Route::get('/mnt/provider/create', function () { |
|
56 | +Route::get('/mnt/provider/create', function() { |
|
57 | 57 | return view('create'); |
58 | 58 | }); |
59 | 59 | |
60 | -Route::get('/test/datepicker', function () { |
|
60 | +Route::get('/test/datepicker', function() { |
|
61 | 61 | return view('datepicker'); |
62 | 62 | }); |
63 | 63 | |
64 | -Route::get('news', ['as' => 'news.index', 'uses' => 'NewsController@index']); |
|
65 | -Route::get('news/add', ['as' => 'news.create', 'uses' => 'NewsController@create']); |
|
66 | -Route::post('news/store', ['as' => 'news.store', 'uses' => 'NewsController@store']); |
|
67 | -Route::get('news/edit/{id}', ['as' => 'news.edit', 'uses' => 'NewsController@edit']); |
|
68 | -Route::patch('news/update/{id}', ['as' => 'news.update', 'uses' => 'NewsController@update']); |
|
69 | -Route::delete('news/delete/{id}', ['as' => 'news.destroy', 'uses' => 'NewsController@destroy']); |
|
70 | -Route::get('news/{slug}', ['as' => 'news.show', 'uses' => 'NewsController@show']); |
|
64 | +Route::get('news', [ 'as' => 'news.index', 'uses' => 'NewsController@index' ]); |
|
65 | +Route::get('news/add', [ 'as' => 'news.create', 'uses' => 'NewsController@create' ]); |
|
66 | +Route::post('news/store', [ 'as' => 'news.store', 'uses' => 'NewsController@store' ]); |
|
67 | +Route::get('news/edit/{id}', [ 'as' => 'news.edit', 'uses' => 'NewsController@edit' ]); |
|
68 | +Route::patch('news/update/{id}', [ 'as' => 'news.update', 'uses' => 'NewsController@update' ]); |
|
69 | +Route::delete('news/delete/{id}', [ 'as' => 'news.destroy', 'uses' => 'NewsController@destroy' ]); |
|
70 | +Route::get('news/{slug}', [ 'as' => 'news.show', 'uses' => 'NewsController@show' ]); |
|
71 | 71 | |
72 | 72 | Route::resource('system-management/country', 'CountryController'); |
73 | 73 | Route::post('system-management/country/search', 'CountryController@search')->name('country.search'); |
74 | 74 | |
75 | -Route:: get('dashboard', function () { |
|
75 | +Route:: get('dashboard', function() { |
|
76 | 76 | return view('dashboard'); |
77 | 77 | }); |
78 | 78 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | Route::get('tasks', 'DashboardController@tasks')->name('tasks'); |
118 | 118 | |
119 | -Route::group(['middleware' => 'web'], function () { |
|
119 | +Route::group([ 'middleware' => 'web' ], function() { |
|
120 | 120 | Route::get('/vuejscrud', 'BlogController@vueCrud'); |
121 | 121 | Route::resource('vueitems', 'BlogController'); |
122 | 122 | |
123 | 123 | |
124 | -Route::group(['middleware' => 'auth'], function () { |
|
124 | +Route::group([ 'middleware' => 'auth' ], function() { |
|
125 | 125 | Route::resource('inventory', 'InventoryController'); |
126 | 126 | }); |
@@ -20,8 +20,8 @@ |
||
20 | 20 | */ |
21 | 21 | public function register() |
22 | 22 | { |
23 | - include __DIR__.'/routes.php'; |
|
24 | - $this->app->make('Scool\Inventory\InventoryController'); |
|
23 | + include __DIR__.'/routes.php'; |
|
24 | + $this->app->make('Scool\Inventory\InventoryController'); |
|
25 | 25 | if (!defined('SCOOL_INVENTORY_PATH')) { |
26 | 26 | define('SCOOL_INVENTORY_PATH', realpath(__DIR__.'/../../')); |
27 | 27 | } |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function register() |
22 | 22 | { |
23 | - include __DIR__.'/routes.php'; |
|
23 | + include __DIR__ . '/routes.php'; |
|
24 | 24 | $this->app->make('Scool\Inventory\InventoryController'); |
25 | 25 | if (!defined('SCOOL_INVENTORY_PATH')) { |
26 | - define('SCOOL_INVENTORY_PATH', realpath(__DIR__.'/../../')); |
|
26 | + define('SCOOL_INVENTORY_PATH', realpath(__DIR__ . '/../../')); |
|
27 | 27 | } |
28 | 28 | $this->registerNamesServiceProvider(); |
29 | 29 | $this->registerStatefulEloquentServiceProvider(); |
30 | 30 | $this->bindRepositories(); |
31 | - $this->app->bind(StatsRepositoryInterface::class, function () { |
|
31 | + $this->app->bind(StatsRepositoryInterface::class, function() { |
|
32 | 32 | return new CacheableStatsRepository(new StatsRepository()); |
33 | 33 | }); |
34 | 34 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | { |
85 | 85 | if (!$this->app->routesAreCached()) { |
86 | 86 | $router = app('router'); |
87 | - $router->group(['namespace' => 'Scool\Inventory\Http\Controllers'], function () { |
|
88 | - require __DIR__.'/../Http/routes.php'; |
|
87 | + $router->group([ 'namespace' => 'Scool\Inventory\Http\Controllers' ], function() { |
|
88 | + require __DIR__ . '/../Http/routes.php'; |
|
89 | 89 | }); |
90 | 90 | } |
91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function loadViews() |
97 | 97 | { |
98 | - $this->loadViewsFrom(SCOOL_INVENTORY_PATH.'/resources/views', 'inventory'); |
|
98 | + $this->loadViewsFrom(SCOOL_INVENTORY_PATH . '/resources/views', 'inventory'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | private function loadMigrations() |
105 | 105 | { |
106 | - $this->loadMigrationsFrom(SCOOL_INVENTORY_PATH.'/database/migrations'); |
|
106 | + $this->loadMigrationsFrom(SCOOL_INVENTORY_PATH . '/database/migrations'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ScoolInventory::configs(), 'scool_inventory' |
126 | 126 | ); |
127 | 127 | $this->mergeConfigFrom( |
128 | - SCOOL_INVENTORY_PATH.'/config/inventory.php', 'scool_inventory' |
|
128 | + SCOOL_INVENTORY_PATH . '/config/inventory.php', 'scool_inventory' |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | private function publishTests() |
136 | 136 | { |
137 | 137 | $this->publishes( |
138 | - [SCOOL_INVENTORY_PATH.'/tests/InventoryTest.php' => 'tests/InventoryTest.php'], |
|
138 | + [ SCOOL_INVENTORY_PATH . '/tests/InventoryTest.php' => 'tests/InventoryTest.php' ], |
|
139 | 139 | 'scool_inventory' |
140 | 140 | ); |
141 | 141 | } |
@@ -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 | } |
@@ -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 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 | } |