| @@ 31-47 (lines=17) @@ | ||
| 28 | ||
| 29 | class ApiManagerController extends Controller |
|
| 30 | { |
|
| 31 | public function index(Request $request) |
|
| 32 | { |
|
| 33 | try { |
|
| 34 | if($request->get('search') != ''){ |
|
| 35 | $data['data'] = ApiKeys::with('getUserName')->with('getHistory') |
|
| 36 | ->where('client', 'like', '%'.$request->get('search').'%') |
|
| 37 | ->orderBy('id', 'desc') |
|
| 38 | ->paginate(env('PAGINATE', 10)); |
|
| 39 | } else{ |
|
| 40 | $data['data'] = ApiKeys::with('getUserName')->with('getHistory') |
|
| 41 | ->orderBy('id', 'desc')->paginate(env('PAGINATE', 10)); |
|
| 42 | } |
|
| 43 | } catch (Exception $e) { |
|
| 44 | $data['data'] = []; |
|
| 45 | } |
|
| 46 | return view('api_manager.index', $data); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function create() |
|
| 50 | { |
|
| @@ 25-46 (lines=22) @@ | ||
| 22 | * |
|
| 23 | * @return Response |
|
| 24 | */ |
|
| 25 | public function index(Request $request) |
|
| 26 | { |
|
| 27 | try { |
|
| 28 | if($request->get('search') != ''){ |
|
| 29 | $data['data'] = Hostkeys::with('getState') |
|
| 30 | ->with('getTransition') |
|
| 31 | ->with('getUserName') |
|
| 32 | ->where('hostname', 'like', '%'.$request->get('search').'%') |
|
| 33 | ->orderBy('id', 'desc') |
|
| 34 | ->paginate(env('PAGINATE', 10)); |
|
| 35 | } else{ |
|
| 36 | $data['data'] = Hostkeys::with('getState') |
|
| 37 | ->with('getTransition') |
|
| 38 | ->with('getUserName') |
|
| 39 | ->orderBy('id', 'desc') |
|
| 40 | ->paginate(env('PAGINATE', 10)); |
|
| 41 | } |
|
| 42 | } catch (Exception $e) { |
|
| 43 | $data['data'] = []; |
|
| 44 | } |
|
| 45 | return view('host_keys.index', $data); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Show the form for creating a new resource. |
|