コード例 #1
0
 public function getJsonList(Request $request)
 {
     $searchPhrase = $request->searchPhrase;
     $field = 'id';
     $order = 'ASC';
     if ($request->has('sort')) {
         $sort = $request->sort;
         $field = key($sort);
         $order = $request->sort[$field];
     }
     $tipos_preguntas = TipoPregunta::where('descripcion', 'LIKE', "%{$searchPhrase}%")->orderBy($field, $order)->get();
     return response()->json(['current' => 1, 'rowCount' => 10, 'rows' => $tipos_preguntas, 'total' => $tipos_preguntas->count()]);
 }
コード例 #2
0
ファイル: ClienteController.php プロジェクト: ericray/gas
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $sucursales = SucursalGasolinera::all()->lists('nombre', 'id');
     $tipos_preguntas = TipoPregunta::all()->lists('descripcion', 'id');
     return view('cliente.form')->with(compact('sucursales', 'tipos_preguntas'));
 }