예제 #1
0
파일: User.php 프로젝트: echiteri/iBLIS
 /**
  * Get the patients registered by a user
  *
  * @return db resultset
  */
 public static function getPatientsRegistered($from, $to, $userID = 0)
 {
     $patients = Patient::select(['id'])->whereBetween('created_at', [$from, $to]);
     if ($userID > 0) {
         $patients = $patients->where('created_by', '=', $userID);
     }
     return $patients->get();
 }
예제 #2
0
 public function index(Request $request)
 {
     if ($request->ajax()) {
         $patient = Patient::select(['id', 'name', 'mobile', 'date_of_birth', 'image'])->get();
         return Datatables::of($patient)->addColumn('Image', function ($item) {
             return '<img src="' . $item->image . ' " alt="Smiley face" height="42" width="42">';
         })->addColumn('Operations', function ($item) {
             $form = \Form::open(['method' => 'DELETE', 'url' => 'patient/' . $item->id, 'class' => 'table-form-inline', 'data-bb' => 'confirm']);
             $form .= \Form::hidden('id', $item->id);
             $form .= \Form::button('<i class="glyphicon glyphicon-trash"></i> Delete', ['class' => 'btn btn-danger btn-xs', 'type' => 'submit']);
             $form .= \Form::close();
             $form .= ' ' . link_to('patient/' . $item->id . '/edit', $title = "Edit", $attributes = ['class' => 'btn btn-primary btn-xs glyphicon glyphicon-edit'], $secure = null);
             return $form;
         })->removeColumn('id')->removeColumn('image')->make();
     }
     return view('patient.list');
 }