Example #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $agent = new Agent();
     $lb_data = new Agent();
     dd($lb_data->coversionAgents());
     //        return view('leaderboard', );
 }
 public function testCallPlanet()
 {
     // Given
     $fakePhoneNumber = '+1555999000';
     $newAgent = new Agent(['extension' => 'Brodo', 'phone_number' => $fakePhoneNumber]);
     $newAgent->save();
     // When
     $response = $this->call('GET', route('extension-connection'), ['Digits' => 2]);
     $menuResponse = new SimpleXMLElement($response->getContent());
     // Then
     $this->assertEquals($fakePhoneNumber, $menuResponse->Dial->Number);
 }
 /**
  * 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]);
 }
Example #4
0
 public function run()
 {
     DB::table('agents')->delete();
     $collection = [['loan_id' => 1, 'agency' => 'ARM', 'agent' => 'James Bond', 'city_state' => 'Rayville, LA', 'phone' => '8003216789', 'email' => '*****@*****.**'], ['loan_id' => 2, 'agency' => 'ARM', 'agent' => 'James Bond', 'city_state' => 'Rayville, LA', 'phone' => '8003216789', 'email' => '*****@*****.**'], ['loan_id' => 2, 'agency' => 'Farm State', 'agent' => 'Jason Bourne', 'city_state' => 'Monroe, LA', 'phone' => '8005551212', 'email' => '*****@*****.**']];
     foreach ($collection as $record) {
         Agent::create($record);
     }
 }
Example #5
0
 public function run()
 {
     DB::table('agents')->delete();
     $collection = [['agency_id' => 1, 'agent' => 'James Bond', 'agent_phone' => '8003216789', 'agent_email' => '*****@*****.**'], ['agency_id' => 2, 'agent' => 'Katniss Everdeen', 'agent_phone' => '8001239876', 'agent_email' => '*****@*****.**'], ['agency_id' => 2, 'agent' => 'Peeta Mallark', 'agent_phone' => '8001239878', 'agent_email' => '*****@*****.**'], ['agency_id' => 2, 'agent' => 'Bilbo Baggins', 'agent_phone' => '7001239876', 'agent_email' => '*****@*****.**'], ['agency_id' => 2, 'agent' => 'Frodo Baggins', 'agent_phone' => '7001239878', 'agent_email' => '*****@*****.**'], ['agency_id' => 2, 'agent' => 'Samwise Gangee', 'agent_phone' => '7001239877', 'agent_email' => '*****@*****.**']];
     foreach ($collection as $record) {
         Agent::create($record);
     }
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $this->agent = Agent::find($this->user->getKey());
     if (empty($this->agent)) {
         return $this->error('agent.failure_noexists');
     }
     $this->stores_ids = Agent::find($this->agent->getKey())->store_ids()->toArray();
     $this->viewData['_agent'] = $this->agent;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $agents = ['Bùi Mỹ Vân', 'Bùi Thanh Hà'];
     $emails = ['*****@*****.**', '*****@*****.**'];
     $mobiles = ['0932622017', '01654477039'];
     $thumnails = ['/frontend/images1/Agents/BuiMyVan.png', '/frontend/images1/Agents/BuiThanhHa.png'];
     foreach ($agents as $key => $value) {
         $project_type = Agent::create(['name' => $agents[$key], 'email' => $emails[$key], 'mobile' => $mobiles[$key], 'thumnail' => $thumnails[$key], 'priority' => $key, 'active' => 1, 'created_by' => 'vankhoe', 'updated_by' => 'vankhoe']);
     }
 }
 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();
     }
 }
Example #9
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Agent::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
 public function addToFavorites(Request $request)
 {
     $agent = Agent::find($request->get('agent'));
     $user_sender_id = Auth::user()->id;
     $user_receiver_id = $agent->user->id;
     if ($user_sender_id == $user_receiver_id) {
         return Redirect::back()->with('warn_message', 'Cannot favorite your own post');
     }
     FavoriteAgent::create(['user_id' => $user_sender_id, 'agent_id' => $agent->id]);
     Notifynder::category('user.favorite')->from($user_sender_id)->to($user_receiver_id)->url('http://homestead.app/agents/' . $agent->id)->send();
     return Redirect::back();
 }
 public function testIndex()
 {
     // Given
     $fakeNumber = '+15558884441';
     $fakeRecording = 'http://help-pls.mp3';
     $fakeTranscription = 'Help me I am trapped in a phone exchange';
     $newAgent = new Agent(['extension' => 'Alderaan', 'phone_number' => '+15559997771']);
     $newAgent->save();
     $newRecording = new Recording(['caller_number' => $fakeNumber, 'transcription' => $fakeTranscription, 'recording_url' => $fakeRecording, 'agent_id' => $newAgent->id]);
     $newRecording->save();
     // When
     $response = $this->call('GET', route('agent-recordings') . '?agentNumber=15559997771');
     $responseContext = $response->getOriginalContent();
     // Then
     $this->assertCount(1, $responseContext['recordings']);
     $recordings = $responseContext['recordings'];
     $this->assertEquals($fakeNumber, $recordings[0]->caller_number);
     $this->assertEquals($fakeTranscription, $recordings[0]->transcription);
     $this->assertEquals($fakeRecording, $recordings[0]->recording_url);
     $this->assertEquals($newAgent->id, $recordings[0]->agent_id);
 }
 /**
  * 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]);
 }
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('agents')->truncate();
        $agents = [['name' => 'Jonathan Jacobs', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => 'Jonathan Jacobs has been a licensed agent in Las Vegas since 2005 and a resident since 1995. Specializing in selling and acquiring residential single family homes for his clients, he has sold hundreds of properties in the Las Vegas valley. Mr. Jacobs has been involved in all aspects of the single family investment process, facilitating construction, leasing and property management services, selling and acquiring for investor clients and developers. Jonathan is an expert in Marketing and negotiation of homes in Las Vegas, where he lives and works. He was recently named a top 40 under 40 agent in Las Vegas by GLVAR and a top 250 Hispanic agent out of more than 50,000 agents in the Nation by NAHREP. Jonathan is fluent in both English and Spanish.'], ['name' => 'William Jacobs', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => 'William has been involved in the Las Vegas Real Estate market for over a decade. Prior to becoming licensed, William managed acquisitions, construction, marketing, and leasing for countless properties across the Las Vegas Valley. An vast amount of Mr. Jacobs time is spent on helping out our communities and those who serve them. As a testament to that, he has helped develop and manage programs, such as the Helping our Heroes program for the Las Vegas Police Deparment and the Fireproof program for the Fire Deparment. William is an expert is residential real estate, and is always just a phone call away.'], ['name' => 'Nicole Davis', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => 'Nicole began her career in real estate in 2011 where she started as the receptionist of Simply Vegas. Her ever-expanding role with the company quickly evolved in to becoming the Office Manager, to where she performs a wide variety of tasks including transaction coordination and file management. Before working in real estate she was an administrative assistant for a structural engineering firm, also assisting in project coordination. This background has helped her be meticulous in organization and dedicated to providing an extremely high standard of customer service.'], ['name' => 'Mark Doppe', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => ''], ['name' => 'Kelly', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => ''], ['name' => 'Vasily', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '', 'description' => ''], ['name' => 'Washington Gonzalez', 'email' => '*****@*****.**', 'title' => 'Real Estate Agent', 'phone' => '602-791-1707', 'description' => 'Washington has been in the real estate industry for more than 10 years. Originally from Mexico City, Washington is bilingual and bi-cultural, speaking both Spanish and English fluently, as well as understanding both the Hispanic and Anglo cultures.

				His focus is on his clients preferences and objectives. Their complete satisfaction is a constant goal by delivering exceptional customer service. Known as having a connect to people personality, Washington easily communicates and interacts with clients who encompass a wide range of ages, races and backgrounds.

				Washington has experience representing buyers, sellers, Bankruptcy Trustees, and has performed bilingual acquisition and disposition services for the Community Noise Reduction Program (CNRP), with the City of Phoenix. Washington also has experience with property management for distressed properties.

				Washington holds a Bachelor of Business Administration in Marketing and International Business from Loyola University New Orleans.']];
        foreach ($agents as $agent) {
            \App\Agent::create($agent);
        }
    }
Example #14
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');
 }
Example #15
0
 public function doAudit()
 {
     if ($this->audited) {
         return false;
     }
     $agent = Agent::find($this->aid);
     if (empty($agent)) {
         return false;
     }
     $user = (new User())->get($this->username) ?: (new User())->add(['username' => $this->username, 'password' => substr($this->idcard, -6), 'realname' => $this->realname, 'idcard' => $this->idcard, 'phone' => $this->username], Role::STORE);
     $store = Store::find($user->getKey()) ?: Store::create(['id' => $user->getKey(), 'name' => $this->name, 'phone' => $this->phone, 'address' => $this->address]);
     $user->roles()->sync([Role::where('name', Role::STORE)->firstOrFail()->getKey()], false);
     $agent->stores()->sync([$store->getKey()], false);
     $store->brands()->sync($this->brand_ids, false);
     $this->audited = true;
     $this->save();
     return true;
 }
 /**
  * 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.');
         //}
     }
 }
 public function run()
 {
     DB::table('agents')->delete();
     Agent::create(['email' => '*****@*****.**', 'first_name' => 'Kalyan', 'last_name' => 'Dey', 'password' => '123456']);
 }
Example #19
0
 public function destroy(Request $request, $id)
 {
     empty($id) && !empty($request->input('id')) && ($id = $request->input('id'));
     $id = (array) $id;
     $factory_brand_ids = $this->factory->brand_ids()->toArray();
     foreach ($id as $v) {
         $agent = Agent::find($v);
         //删除所属门店下的相关品牌列表
         $original_brand_ids = $agent->brands()->whereIn('brands.id', $factory_brand_ids)->get(['brands.id'])->pluck('id');
         foreach ($agent->stores as $store) {
             $store->brands()->detach($original_brand_ids);
         }
         //删除厂商关联
         $agent->factories()->detach($this->factory->getKey());
         //删除品牌关联
         $agent->brands()->detach($factory_brand_ids);
     }
     return $this->success('', count($id) > 5, compact('id'));
 }
 public function showAgents()
 {
     $agents = \App\Agent::all();
     return view('pages.listAgents')->with(['agents' => $agents, 'communities' => $this->communities]);
 }
Example #21
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 . " ) ";
 }
Example #22
0
 public function destroy(Request $request, $id)
 {
     empty($id) && !empty($request->input('id')) && ($id = $request->input('id'));
     $id = (array) $id;
     foreach ($id as $v) {
         $agent = Agent::destroy($v);
     }
     return $this->success('', count($id) > 5, compact('id'));
 }
Example #23
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'));
 }
 public function findCode($id)
 {
     $agent = Agent::where('id', $id)->select('agent_code')->first();
     return response()->success($agent);
 }
Example #25
0
 public function pay($total_fee, $transaction = TRUE)
 {
     $transaction && DB::beginTransaction();
     $order = static::where($this->getKeyName(), $this->getKey())->lockForUpdate()->first();
     if ($order->status != static::INIT) {
         $transaction && DB::rollback();
         return false;
     }
     //对账失败
     if (abs($total_fee - $order->total_money * 100) >= 0.01) {
         $order->status = static::COMPARE_BILL_FAIL;
         $order->save();
         $transaction && DB::commit();
         return false;
     }
     //用户已消费
     $order->bills()->create(['value' => -$order->total_money, 'uid' => $order->uid, 'event' => Bill::PURCHASE]);
     //一个订单里面只能有一个厂家的details
     $details = $order->details;
     $total = $details->sum('money');
     $factory_money = $order->total_money;
     $store_money = $agent_money = [];
     $user_stores = User::find($order->uid)->stores()->get(['stores.id']);
     //关注的店铺
     foreach ($details as $detail) {
         $rate = $order->details_money * $detail->money / $total;
         $brand = $detail->product->brand;
         $store = Store::whereIn('stores.id', $user_stores->pluck('id')->toArray())->join('store_brand', 'store_brand.sid', '=', 'stores.id')->where('store_brand.bid', $brand->getKey())->first(['stores.*']);
         if (!empty($store)) {
             !isset($store_money[$store->getKey()]) && ($store_money[$store->getKey()] = 0);
             $store_money[$store->getKey()] += $value = $rate * $detail->product->shop_rate / 100;
             $factory_money -= $value;
             $agent = Agent::whereIn('agents.id', $store->agent_ids()->toArray())->join('agent_brand', 'agent_brand.aid', '=', 'agents.id')->where('agent_brand.bid', $brand->getKey())->first(['agents.*']);
             if (!empty($agent)) {
                 !isset($agent_money[$agent->getKey()]) && ($agent_money[$agent->getKey()] = 0);
                 $agent_money[$agent->getKey()] += $value = $rate * $detail->product->agent_rate / 100;
                 $factory_money -= $value;
             }
         }
     }
     if (!empty($details)) {
         //门店提成
         foreach ($store_money as $uid => $value) {
             $order->bills()->create(['value' => $value, 'uid' => $uid, 'event' => Bill::COMMISSION]);
         }
         //代理商提成
         foreach ($agent_money as $uid => $value) {
             $order->bills()->create(['value' => $value, 'uid' => $uid, 'event' => Bill::COMMISSION]);
         }
         //厂商收入
         $order->bills()->create(['value' => $factory_money < 0 ? 0 : $factory_money, 'uid' => $details[0]->product->fid, 'event' => Bill::INCOME]);
     }
     $order->status = static::PAID;
     $order->save();
     if (intval($order->bonus_id) > 0) {
         $bonus = ActivityBonus::where('id', $order->bonus_id)->lockForUpdate()->first();
         $bonus->status = 2;
         //已使用红包
         $bonus->save();
     }
     $transaction && DB::commit();
     return true;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $agent = Agent::find($id);
     $agent->delete();
     return Redirect::route('agent_management')->with('success', 'Agent has been deleted successfully!');
 }
Example #27
0
 /**
  * Delete the given Agent.
  *
  * @param  int      $id
  * @return Redirect
  */
 public function getDelete($id = null)
 {
     $agent = Agent::destroy($id);
     // Redirect to the group management page
     return redirect('admin/agents')->with('success', Lang::get('message.success.delete'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     DB::transaction(function () use($id) {
         $user = Auth::user();
         $agent = Agent::findOrFail($id);
         $agent->updated_by = $user->name;
         $agent->deleted_by = $user->name;
         $agent->key = $agent->key . '-' . microtime(true);
         $agent->save();
         // soft delete
         $agent->delete();
     });
 }
Example #29
0
 /**
  * 	Shows some of the information of a particular user
  *	based on the user's ID 
  *	if no user is found based on ID, it will gracefully fail
  *	@todo
  *	shold only be available to Admin
  *	things such as password should not appear?
  *
  */
 public function show($id)
 {
     $agent = Agent::findOrFail($id);
     return view('agent.show', compact('agent'));
 }