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'); }
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')); }
/** * 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; }
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()); } }