| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Http\Controllers\Admin;
- use App\Models\AppSwitch;
- use Illuminate\Http\Request;
- class SwitchesController
- {
- public function index(Request $request)
- {
- $query = AppSwitch::query();
- if ($request->input('name')) {
- $query->where('name', $request->input('name'));
- }
- $switches = $query->paginate(20);
- return view('admin.switches.index', [
- 'list' => $switches,
- 'request' => $request,
- ]);
- }
- public function setStatus($id)
- {
- $appSwitch = AppSwitch::findOrFail($id);
- $appSwitch->status = $appSwitch->status ? 0 : 1;
- $appSwitch->save();
- return apiReturnSuc();
- }
- }
|