예제 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::wantsJson()) {
         $query = User::join('user_roles', 'users.role_id', '=', 'user_roles.id');
         //->where('county_id', config('app.county'));
         $input = Input::only('draw', 'columns', 'search', 'order', 'start', 'length');
         $dt = new DataTables($query, $input);
         $dt->column('users.id', 'id')->column('full_name')->column('email')->column('users.created_at', 'created_at')->column('user_roles.name', 'role');
         $data = $dt->get(function ($user) {
             return [$user->id, $user->full_name, $user->email, $user->created_at->format('d-m-Y H:i'), $user->role];
         });
         return json($data);
     }
     return view('admin.users.index')->with('roles', Role::all());
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::wantsJson()) {
         $input = Input::only('draw', 'columns', 'search', 'order', 'start', 'length');
         $input['columns'][4] = ['data' => 4, 'searchable' => 'true'];
         $query = ContactMessage::where('county_id', config('app.county'));
         $dt = new DataTables($query, $input);
         $dt->column('id')->column('name')->column('subject')->column('created_at', function ($date) {
             return $date->format('d-m-Y H:i');
         })->column('email')->column('message')->column('replied', function ($data) {
             return (bool) $data;
         })->column('user_id');
         return json($dt->get());
     }
     return view('admin.contact.index');
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::wantsJson()) {
         $query = Response::join('quiz', 'response.quiz_id', '=', 'quiz.id')->join('areas', function ($join) {
             $join->on('quiz.area_id', '=', 'areas.id')->where('areas.county_id', '=', config('app.county'));
         })->leftJoin('area_categories', 'quiz.category_id', '=', 'area_categories.id')->join('users', 'users.id', '=', 'user_id');
         $input = Input::only('draw', 'columns', 'search', 'order', 'start', 'length');
         $input['columns'][4] = ['data' => 4, 'searchable' => 'true'];
         $dt = new DataTables($query, $input);
         $dt->column('full_name')->column('areas.name', 'area_name')->column('response.created_at', 'created_at')->column('user_id')->column('area_categories.name', 'category_name')->column('response.id', 'id');
         $data = $dt->get(function ($result) {
             return [['id' => $result->user_id, 'name' => $result->full_name], ['area' => $result->area_name, 'category' => $result->category_name], $result->created_at->format('d-m-Y H:i'), $result->id];
         });
         return json($data);
     }
     return view('admin.responses.index');
 }