public function showSingleAgents(Request $request, $agent)
 {
     $agent = \App\Agent::where('name', '=', $agent)->first();
     if (is_null($agent)) {
         abort(404);
     }
     return view('pages.agentDetails')->with(['agent' => $agent, 'communities' => $this->communities, 'communitySelect' => $this->communitySelect]);
 }
 /**
  * Shows an index of existings recordings
  *
  * @return \Illuminate\Http\Response
  */
 public function indexByAgent(Request $request)
 {
     $agentNumber = $request->input('agentNumber');
     $agentNumberInE164Format = '+' . $agentNumber;
     $agent = Agent::where(['phone_number' => $agentNumberInE164Format])->firstOrFail();
     $allRecordings = Recording::where(['agent_id' => $agent->id])->get();
     return response()->view('recordings.index', ['recordings' => $allRecordings, 'agent' => $agent]);
 }
 private function _getAgentForDigit($digit)
 {
     $planetExtensions = ['2' => 'Brodo', '3' => 'Dagobah', '4' => 'Oober'];
     $planetExtensionExists = isset($planetExtensions[$digit]);
     if ($planetExtensionExists) {
         $agent = Agent::where('extension', '=', $planetExtensions[$digit])->firstOrFail();
         return $agent;
     } else {
         throw new ModelNotFoundException();
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $this->setMetadata();
     $provinces = Province::where('is_publish', 1)->get();
     $projectCategory = new ProjectCategory();
     $projectsSpecial = $projectCategory->getProjectsByCategoryKey('du-an-noi-bat', 3);
     $projectsNew = $projectCategory->getProjectsByCategoryKey('du-an-moi-nhat', 3);
     $product_types = Product_type::where('active', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get();
     $agents = Agent::where('active', 1)->orderBy('priority')->orderBy('created_at', 'desc')->take(4)->get();
     //$canHoChoThue = $product_type->getProductsByTypeKey('can-ho-sang-nhuong', 3);
     //$productAll = Product::where('active',1)->get();
     return view('frontend.sites1.index', ['provinces' => $provinces, 'projectsSpecial' => $projectsSpecial, 'projectsNew' => $projectsNew, 'product_types' => $product_types, 'agents' => $agents]);
 }
Example #5
0
 /**
  * Handle a registration request for the application.
  *
  * @param  RegisterRequest  $request
  * @return Response
  */
 public function postRegister(RegisterRequest $request)
 {
     //code for registering a user goes here.
     $this->agent->name = $request->name;
     $this->agent->email = $request->email;
     $this->agent->password = bcrypt($request->password);
     $this->agent->save();
     //$this->auth->login($this->agent);
     $role_id = $request->input('roles');
     $program_ids = $request->input('programs');
     $agent = Agent::where('email', '=', $request->email)->first();
     $agent->roles()->attach($role_id);
     $agent->program()->attach($program_ids);
     $agent->save();
     return redirect()->action('HomeController@index');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $agent_id = Session::get('AGENT_ACCESS_ID');
     $data = array();
     $data['record'] = Agent::find($agent_id);
     if ($request->isMethod('post')) {
         $first_name = $request->first_name;
         $last_name = $request->last_name;
         $phone = $request->phone;
         $password = $request->password;
         $update_arr = array('first_name' => $first_name, 'last_name' => $last_name, 'phone' => $phone);
         if ($password != '') {
             $update_arr['password'] = md5($password . Config::get('constants.SITENAME'));
         }
         Agent::where('id', '=', $agent_id)->update($update_arr);
         Session::put('ADMIN_ACCESS_FNAME', $first_name);
         Session::put('ADMIN_ACCESS_LNAME', $last_name);
         return redirect::route('agent_profile')->with('successmsg', 'Profile is updated successfully');
     }
     return view('agent/profile', $data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $agent_email = $request->get('agent_email');
         $agent_password = $request->get('agent_password');
         $checkAgentExists = Agent::where("email", "=", $agent_email);
         //$checkAgentExists	= $checkAgentExists->where("password", "=", md5($agent_password.\Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('agent_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('agent_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('agent_email'));
             $cookieJar->queue(Cookie::forget('agent_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($agent_password, $checkAgentExists[0]->password)) {
                 Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::to('agent/dashboard');
             } else {
                 return redirect::route('agent')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('agent')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
         //if(count($checkAgentExists) > 0){
         //	Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
         //	Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
         //	Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
         //	return redirect('agent/dashboard');
         //}else{
         //	return redirect('agent')->with('message', 'Invalid email address or/and password.');
         //}
     }
 }
Example #8
0
 /**
  * Generate an address for a location
  * @param $location
  * @return string
  */
 private function generateAddress($location)
 {
     $locationName = $location->locationKeyCode;
     $locationId = $location->id;
     $location = $this->location->findOrFail($locationId);
     $levelId = $location->level_id;
     $level = $this->level_building->findOrFail($levelId);
     $levelName = $level->levelName;
     $building_id = $level->building_id;
     $building = $this->building->findOrFail($building_id);
     $buildingName = $building->buildingKeyCode;
     $street_id = $building->street_id;
     $street = $this->street->findOrFail($street_id);
     $streetName = $street->streetKeyCode;
     $agent_id = $street->agent_id;
     $this->agent_id = $agent_id;
     //$agent = $this->agent->findOrFail($agent_id);
     $agentName = \App\Agent::where('user_id', '=', $agent_id)->first()->agentName;
     return $buildingName . $levelName . $locationName . "-" . $streetName . " ( " . $agentName . " ) ";
 }
 public function findCode($id)
 {
     $agent = Agent::where('id', $id)->select('agent_code')->first();
     return response()->success($agent);
 }
Example #10
0
 /**
  * Search for an agent
  * @return \Illuminate\View\View
  */
 public function search()
 {
     $results = \App\Agent::where('agentName', '=', $_POST['search'])->first();
     $agent_id = $results->user_id;
     $addresses = \App\Address::where('agent_id', '=', $agent_id);
     return view('address.manage', compact('results', 'addresses', 'usage'));
 }