コード例 #1
0
ファイル: Lead.php プロジェクト: morph07/lead-scheduler
 public static function updateLead($request, $lead)
 {
     $lead = Lead::find($lead->id);
     $lead->update(['disposition_id' => $request->get('disposition_id')]);
     if ($request->get('disposition_id') == 3) {
         $newCallback = new Callback();
         $newCallback->callback_date = date('Y-m-d', strtotime($request->get('date_schedule')));
         $newCallback->callback_time = date('H:i:s', strtotime($request->get('time_schedule')));
         $newCallback->lead_id = $lead->id;
         $newCallback->save();
     }
     $recordDispositionLead = new DispositionLead();
     $recordDispositionLead->user_id = Auth::user()->id;
     $recordDispositionLead->lead_id = $lead->id;
     $recordDispositionLead->disposition_id = $request->get('disposition_id');
     $recordDispositionLead->save();
     return Redirect::back()->with('message', 'Lead has been updated');
 }
コード例 #2
0
ファイル: User.php プロジェクト: encry2024/nsi-crm-healthcare
 public static function showAdminDashboard()
 {
     $ctr = 0;
     $all_records = Record::with(['user' => function ($query) {
         $query->where('type', '=', 'agent');
     }]);
     if (!empty(request('gender'))) {
         $all_records = $all_records->where('gender', request('gender'));
     }
     if (!empty(request('age_from'))) {
         $all_records = $all_records->where('age', '>=', request('age_from'));
     }
     if (!empty(request('age_to'))) {
         $all_records = $all_records->where('age', '<=', request('age_to'));
     }
     $all_records = $all_records->orderBy('updated_at')->orderBy('gender')->orderBy('age', 'DESC')->paginate(20);
     $all_records->setPath("?gender=" . request('gender') . "&age_from=" . request('age_from') . "&age_to=" . request('age_to'));
     $callbacks = Callback::where('schedule', '>', date('Y-m-d', strtotime('-2 day', time())))->get();
     return view('auth.dashboard', compact('ctr', 'all_records', 'callbacks'));
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreCallbackRequest $request)
 {
     $store_callback = Callback::storeCallback($request);
     return $store_callback;
 }
コード例 #4
0
 public function postAddcallback()
 {
     if (!Auth::check()) {
         return Redirect::to('leads/login');
     }
     $validator = Validator::make(Input::all(), Callback::$rules);
     if ($validator->passes()) {
         $Callback = new Callback();
         $Callback->user_id = Input::get('user_id');
         $Callback->lead_id = Input::get('lead_id');
         $Callback->call_at = strtotime(Input::get('call_at'));
         $Callback->save();
         return Redirect::to(Input::get('return_url'));
     }
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput($request->flash());
     }
 }