|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Integrations\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
6
|
|
|
use Integrations\Exceptions\Exception; |
|
7
|
|
|
// use Integrations\Http\Controllers\Controller as Base; |
|
8
|
|
|
use Integrations\Models\Token; |
|
9
|
|
|
use Yajra\Datatables\Datatables; |
|
10
|
|
|
use Pedreiro\CrudController; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class TokenController extends Controller |
|
14
|
|
|
{ |
|
15
|
|
|
use CrudController; |
|
16
|
|
|
|
|
17
|
|
|
public function __construct(Token $model) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->model = $model; |
|
20
|
|
|
parent::__construct(); |
|
21
|
|
|
} |
|
22
|
|
|
// /** |
|
23
|
|
|
// * @var string |
|
24
|
|
|
// */ |
|
25
|
|
|
// public $title = 'Tokens'; |
|
26
|
|
|
// public $model = Token::class; |
|
27
|
|
|
|
|
28
|
|
|
// /** |
|
29
|
|
|
// * @var string |
|
30
|
|
|
// */ |
|
31
|
|
|
// public $description = 'Listagem de Tokens.'; |
|
32
|
|
|
|
|
33
|
|
|
// /** |
|
34
|
|
|
// * @var array |
|
35
|
|
|
// */ |
|
36
|
|
|
// public $columns = [ |
|
37
|
|
|
// 'Rule' => 'getAdminTitleAttribute', |
|
38
|
|
|
// ]; |
|
39
|
|
|
|
|
40
|
|
|
// /** |
|
41
|
|
|
// * @var array |
|
42
|
|
|
// */ |
|
43
|
|
|
// public $search = [ |
|
44
|
|
|
// 'from', |
|
45
|
|
|
// 'to', |
|
46
|
|
|
// 'code' => [ |
|
47
|
|
|
// 'type' => 'select', |
|
48
|
|
|
// 'options' => 'Pedreiro\Models\RedirectRule::getCodes()', |
|
49
|
|
|
// ], |
|
50
|
|
|
// 'label', |
|
51
|
|
|
// ]; |
|
52
|
|
|
|
|
53
|
|
|
// /** |
|
54
|
|
|
// * Get the permission options. |
|
55
|
|
|
// * |
|
56
|
|
|
// * @return array An associative array. |
|
57
|
|
|
// */ |
|
58
|
|
|
// public function getPermissionOptions() |
|
59
|
|
|
// { |
|
60
|
|
|
// return array_except(parent::getPermissionOptions(), ['publish']); |
|
61
|
|
|
// } |
|
62
|
|
|
|
|
63
|
|
|
// /** |
|
64
|
|
|
// * Populate protected properties on init |
|
65
|
|
|
// */ |
|
66
|
|
|
// public function __construct() |
|
67
|
|
|
// { |
|
68
|
|
|
// $this->title = __('pedreiro::redirect_rules.controller.title'); |
|
69
|
|
|
// $this->description = __('pedreiro::redirect_rules.controller.description'); |
|
70
|
|
|
// $this->columns = [ |
|
71
|
|
|
// __('pedreiro::redirect_rules.controller.column.rule') => 'getAdminTitleAttribute', |
|
72
|
|
|
// ]; |
|
73
|
|
|
// $this->search = [ |
|
74
|
|
|
// 'from' => [ |
|
75
|
|
|
// 'label' => __('pedreiro::redirect_rules.controller.search.from'), |
|
76
|
|
|
// 'type' => 'text', |
|
77
|
|
|
// ], |
|
78
|
|
|
// 'to' => [ |
|
79
|
|
|
// 'label' => __('pedreiro::redirect_rules.controller.search.to'), |
|
80
|
|
|
// 'type' => 'text', |
|
81
|
|
|
// ], |
|
82
|
|
|
// 'code' => [ |
|
83
|
|
|
// 'label' => __('pedreiro::redirect_rules.controller.search.code'), |
|
84
|
|
|
// 'type' => 'select', |
|
85
|
|
|
// 'options' => 'Pedreiro\Models\RedirectRule::getCodes()', |
|
86
|
|
|
// ], |
|
87
|
|
|
// 'label' => [ |
|
88
|
|
|
// 'label' => __('pedreiro::redirect_rules.controller.search.label'), |
|
89
|
|
|
// 'type' => 'text', |
|
90
|
|
|
// ], |
|
91
|
|
|
// ]; |
|
92
|
|
|
|
|
93
|
|
|
// // parent::__construct(); |
|
94
|
|
|
// } |
|
95
|
|
|
|
|
96
|
|
|
// // /** |
|
97
|
|
|
// // * @var string |
|
98
|
|
|
// // */ |
|
99
|
|
|
// // public $description = "Listagem de Pedidos."; |
|
100
|
|
|
|
|
101
|
|
|
// // /** |
|
102
|
|
|
// // * Display all the workers |
|
103
|
|
|
// // * |
|
104
|
|
|
// // * @return Illuminate\View\View |
|
105
|
|
|
// // */ |
|
106
|
|
|
// // public function index(Request $request) |
|
107
|
|
|
// // { |
|
108
|
|
|
// // return $this->populateView( |
|
109
|
|
|
// // 'admin.orders.index', [ |
|
110
|
|
|
// // 'orders' => Order::orderBy('id', 'DESC')->simplePaginate(50), |
|
111
|
|
|
// // ] |
|
112
|
|
|
// // ); |
|
113
|
|
|
// // } |
|
114
|
|
|
|
|
115
|
|
|
// // /** |
|
116
|
|
|
// // * Ajax service that tails the log file for the selected worker |
|
117
|
|
|
// // * |
|
118
|
|
|
// // * @param $worker |
|
119
|
|
|
// // */ |
|
120
|
|
|
// // public function tail($worker) |
|
121
|
|
|
// // { |
|
122
|
|
|
// // // Form the path to the file |
|
123
|
|
|
// // $file = Worker::logPath(urldecode($worker)); |
|
124
|
|
|
// // if (!file_exists($file)) { |
|
125
|
|
|
// // throw new Exception('Log not found: '.$file); |
|
126
|
|
|
// // } |
|
127
|
|
|
// // $size = 1024 * 100; // in bytes to get |
|
128
|
|
|
|
|
129
|
|
|
// // // Read from the end of the file |
|
130
|
|
|
// // clearstatcache(); |
|
131
|
|
|
// // $fp = fopen($file, 'r'); |
|
132
|
|
|
// // fseek($fp, -$size, SEEK_END); |
|
133
|
|
|
// // $contents = explode("\n", fread($fp, $size)); |
|
134
|
|
|
// // fclose($fp); |
|
135
|
|
|
|
|
136
|
|
|
// // // Reverse the contents and return |
|
137
|
|
|
// // $contents = array_reverse($contents); |
|
138
|
|
|
// // if (empty($contents[0])) { |
|
139
|
|
|
// // array_shift($contents); |
|
140
|
|
|
// // } |
|
141
|
|
|
// // die(implode("\n", $contents)); |
|
142
|
|
|
// // } |
|
143
|
|
|
|
|
144
|
|
|
// // /** |
|
145
|
|
|
// // * Display a listing of the resource. |
|
146
|
|
|
// // * |
|
147
|
|
|
// // * @return \Illuminate\Http\Response |
|
148
|
|
|
// // */ |
|
149
|
|
|
// // public function index(Request $request) |
|
150
|
|
|
// // { |
|
151
|
|
|
// // // if ($request->ajax()) { |
|
152
|
|
|
// // // $query = Order::with('user', 'operadora', 'collaborator', 'customer', 'money')->select('orders.*'); |
|
153
|
|
|
|
|
154
|
|
|
// // // return Datatables::of($query)->addColumn('action', function ($order) { |
|
155
|
|
|
// // // return '<a href="'.route('admin.orders.show',$order->id).'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-eye"></i> Show</a>'; |
|
156
|
|
|
// // // })->setRowId('id')->editColumn('created_at', function ($order) { |
|
157
|
|
|
// // // return $order->created_at->format('h:m:s d/m/Y'); |
|
158
|
|
|
// // // }) |
|
159
|
|
|
// // // ->setRowClass(function ($order) { |
|
160
|
|
|
// // // return $order->status == Order::$STATUS_APPROVED ? 'alert-success' : 'alert-warning'; |
|
161
|
|
|
// // // }) |
|
162
|
|
|
// // // ->setRowData([ |
|
163
|
|
|
// // // 'id' => 'test', |
|
164
|
|
|
// // // ]) |
|
165
|
|
|
// // // ->setRowAttr([ |
|
166
|
|
|
// // // 'color' => 'red', |
|
167
|
|
|
// // // ])->make(true); |
|
168
|
|
|
|
|
169
|
|
|
// // // return $this->dataTable->eloquent($query)->make(true); |
|
170
|
|
|
// // // } |
|
171
|
|
|
// // // return view('admin.orders.index'); |
|
172
|
|
|
|
|
173
|
|
|
// // // USando Service //public function index(UsersDataTable $dataTable) |
|
174
|
|
|
// // // return $dataTable->render('orders.index'); |
|
175
|
|
|
|
|
176
|
|
|
// // if ($request->has('query') && !empty($request->input('query'))) { |
|
177
|
|
|
// // $orders = Order::search($request->input('query'))->orderBy('id', 'DESC')->simplePaginate(50); |
|
178
|
|
|
// // } else { |
|
179
|
|
|
// // $orders = Order::orderBy('id', 'DESC')->simplePaginate(50); |
|
180
|
|
|
// // } |
|
181
|
|
|
// // return view('admin.orders.index', compact('orders')); |
|
182
|
|
|
// // } |
|
183
|
|
|
|
|
184
|
|
|
// // /** |
|
185
|
|
|
// // * Show the form for creating a new resource. |
|
186
|
|
|
// // * |
|
187
|
|
|
// // * @return \Illuminate\Http\Response |
|
188
|
|
|
// // */ |
|
189
|
|
|
// // public function create(Request $request) |
|
190
|
|
|
// // { |
|
191
|
|
|
// // return view('admin.orders.create'); |
|
192
|
|
|
// // } |
|
193
|
|
|
|
|
194
|
|
|
// // /** |
|
195
|
|
|
// // * Store a newly created resource in storage. |
|
196
|
|
|
// // * |
|
197
|
|
|
// // * @param \Illuminate\Http\Request $request |
|
198
|
|
|
// // * @return \Illuminate\Http\Response |
|
199
|
|
|
// // */ |
|
200
|
|
|
// // public function store(Request $request) |
|
201
|
|
|
// // { |
|
202
|
|
|
// // $request->validate([ |
|
203
|
|
|
// // 'total'=>'required', |
|
204
|
|
|
// // 'money'=> 'required|integer', |
|
205
|
|
|
// // 'operadora' => 'required|integer' |
|
206
|
|
|
// // ]); |
|
207
|
|
|
// // $order = new Order([ |
|
208
|
|
|
// // 'total' => $request->get('total'), |
|
209
|
|
|
// // 'money'=> $request->get('money'), |
|
210
|
|
|
// // 'operadora'=> $request->get('operadora') |
|
211
|
|
|
// // ]); |
|
212
|
|
|
// // $order->save(); |
|
213
|
|
|
// // return redirect('/orders')->with('success', 'Stock has been added'); |
|
214
|
|
|
// // } |
|
215
|
|
|
|
|
216
|
|
|
// // /** |
|
217
|
|
|
// // * Display the specified resource. |
|
218
|
|
|
// // * |
|
219
|
|
|
// // * @param int $id |
|
220
|
|
|
// // * @return \Illuminate\Http\Response |
|
221
|
|
|
// // */ |
|
222
|
|
|
// // public function show(Request $request, $id) |
|
223
|
|
|
// // { |
|
224
|
|
|
// // $order = Order::findOrFail($id); |
|
225
|
|
|
// // return view('admin.orders.show', compact('order')); |
|
226
|
|
|
// // } |
|
227
|
|
|
|
|
228
|
|
|
|
|
229
|
|
|
// // /** |
|
230
|
|
|
// // * Show the form for editing the specified resource. |
|
231
|
|
|
// // * |
|
232
|
|
|
// // * @param int $id |
|
233
|
|
|
// // * @return \Illuminate\Http\Response |
|
234
|
|
|
// // */ |
|
235
|
|
|
// // public function edit(Request $request, $id) |
|
236
|
|
|
// // { |
|
237
|
|
|
// // $order = Order::find($id); |
|
238
|
|
|
|
|
239
|
|
|
// // return view('admin.orders.edit', compact('order')); |
|
240
|
|
|
// // } |
|
241
|
|
|
|
|
242
|
|
|
// // /** |
|
243
|
|
|
// // * Update the specified resource in storage. |
|
244
|
|
|
// // * |
|
245
|
|
|
// // * @param \Illuminate\Http\Request $request |
|
246
|
|
|
// // * @param int $id |
|
247
|
|
|
// // * @return \Illuminate\Http\Response |
|
248
|
|
|
// // */ |
|
249
|
|
|
// // public function update(Request $request, $id) |
|
250
|
|
|
// // { |
|
251
|
|
|
// // $request->validate([ |
|
252
|
|
|
// // 'total'=>'required', |
|
253
|
|
|
// // 'money'=> 'required|integer', |
|
254
|
|
|
// // 'operadora' => 'required|integer' |
|
255
|
|
|
// // ]); |
|
256
|
|
|
|
|
257
|
|
|
// // $order = Order::findOrFail($id); |
|
258
|
|
|
// // $order->total = $request->get('total'); |
|
259
|
|
|
// // $order->money = $request->get('money'); |
|
260
|
|
|
// // $order->operadora = $request->get('operadora'); |
|
261
|
|
|
// // $order->save(); |
|
262
|
|
|
|
|
263
|
|
|
// // return redirect('/orders')->with('success', 'Stock has been updated'); |
|
264
|
|
|
// // } |
|
265
|
|
|
|
|
266
|
|
|
// // /** |
|
267
|
|
|
// // * Remove the specified resource from storage. |
|
268
|
|
|
// // * |
|
269
|
|
|
// // * @param int $id |
|
270
|
|
|
// // * @return \Illuminate\Http\Response |
|
271
|
|
|
// // */ |
|
272
|
|
|
// // public function destroy(Request $request, $id) |
|
273
|
|
|
// // { |
|
274
|
|
|
// // $order = Order::findOrFail($id); |
|
275
|
|
|
// // $order->delete(); |
|
276
|
|
|
|
|
277
|
|
|
// // return redirect('/orders')->with('success', 'Stock has been deleted Successfully'); |
|
278
|
|
|
// // } |
|
279
|
|
|
} |
|
280
|
|
|
|