示例#1
0
 public function checkAgency($code)
 {
     $rs = Agency::where('code', '=', $code)->count();
     if (isset($rs)) {
         return $rs >= 1 ? false : true;
     }
 }
 public function getDelete($id)
 {
     $users = Agency::where('id', '=', $id)->get();
     foreach ($users as $user) {
         $user_id = $user->staff_id;
     }
     $userdelete = User::find($user_id);
     $userdelete->delete();
     $agencystaff = Agency::find($id);
     $agencystaff->delete();
     return Redirect::to('dashboard/agencies');
 }
示例#3
0
 public function listActivities()
 {
     $c_u_result = User::where(DB::raw('date(created_at)'), Carbon::today())->get();
     $u_u_result = User::where(DB::raw('date(updated_at)'), Carbon::today())->where(DB::raw('date(created_at)'), '<', DB::raw('date(updated_at)'))->get();
     $c_a_result = Agency::where(DB::raw('date(created_at)'), Carbon::today())->get();
     $u_a_result = Agency::where(DB::raw('date(updated_at)'), Carbon::today())->where(DB::raw('date(created_at)'), '<', DB::raw('date(updated_at)'))->get();
     //retrive report activities
     $c_r_result = Report::where(DB::raw('date(Reports.created_at)'), Carbon::today())->where('isDeleted', 0)->leftjoin('ReportStatusType', 'ReportStatusType.reportStatusTypeId', '=', 'Reports.status')->leftjoin('ReportType', 'ReportType.ReportTypeId', '=', 'Reports.ReportType')->lists('reportName', 'reportedBy', 'location', 'reportStatusTypeName', 'reportTypeName', 'Reports.created_at', 'Reports.updated_at');
     $u_r_result = Report::where(DB::raw('date(Reports.updated_at)'), Carbon::today())->where(DB::raw('date(Reports.created_at)'), '<', DB::raw('date(Reports.updated_at)'))->where('isDeleted', 0)->leftjoin('ReportStatusType', 'ReportStatusType.reportStatusTypeId', '=', 'Reports.status')->leftjoin('ReportType', 'ReportType.ReportTypeId', '=', 'Reports.ReportType')->lists('reportName', 'reportedBy', 'location', 'reportStatusTypeName', 'reportTypeName', 'Reports.created_at', 'Reports.updated_at');
     $d_r_result = Report::where(DB::raw('date(Reports.deleted_at)'), Carbon::today())->where('isDeleted', 1)->leftjoin('ReportStatusType', 'ReportStatusType.reportStatusTypeId', '=', 'Reports.status')->leftjoin('ReportType', 'ReportType.ReportTypeId', '=', 'Reports.ReportType')->lists('reportName', 'reportedBy', 'location', 'reportStatusTypeName', 'reportTypeName', 'Reports.created_at', 'Reports.updated_at');
     $result = array('users_created' => $c_u_result, 'users_updated' => $u_u_result, 'agencies_created' => $c_a_result, 'agencies_updated' => $u_a_result, 'reports_created' => $c_r_result, 'reports_updated' => $u_r_result, 'reports_deleted' => $d_r_result);
     return Response::json($result)->setCallback(Input::get('callback'));
 }
 public function getReply()
 {
     $id = Request::segment(3);
     $inbox_id = Request::segment(4);
     $profiles = Agency::where('staff_id', '=', $id)->get();
     $allTeamsMember = array();
     foreach ($profiles as $profile) {
         if ($profile->user_id != Sentry::getUser()->id) {
             $allTeamsMember[$profile->user_id] = $profile->name;
         }
     }
     // DB::table('inbox')
     //           ->where('to_user', Sentry::getUser()->id)
     //           ->where('id', $inbox_id)
     //           ->update(array('notification' => 0));
     return View::make('message.reply')->with('teams', $allTeamsMember);
 }
示例#5
0
 /**
  * [agencyDel description]
  * @param  [type] $agency_id [description]
  * @return [type]            [description]
  */
 public function agencyDel($agency_id)
 {
     Agency::where('id', '=', $agency_id)->delete();
     return Redirect::to('agency')->with('success', 'ชื่อข้อมูลหน่วยงานรหัส = ' . $agency_id . ' ลบทิ้งสำเร็จ');
 }
示例#6
0
 public function postProfile()
 {
     $fields = array('name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'address' => Input::get('address'), 'country' => Input::get('country'));
     $id = Sentry::getUser()->id;
     DB::table('registration')->where('user_id', '=', $id)->update($fields);
     $proimg = Input::file('photo');
     if ($proimg) {
         $fieldsimg = array('photo' => $this->ImageCrop('photo', 'photos', '200', '200', ''));
         DB::table('registration')->where('user_id', '=', $id)->update($fieldsimg);
     }
     $fieldsname = array('email' => Input::get('email'));
     DB::table('users')->where('id', '=', Sentry::getUser()->id)->update($fieldsname);
     $fieldsstaff = array('email' => Input::get('email'), 'name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'address' => Input::get('address'), 'country' => Input::get('country'));
     Agency::where('staff_id', '=', Sentry::getUser()->id)->update($fieldsstaff);
     return Redirect::to('viewprofile');
 }