当前位置: 首页>>代码示例>>PHP>>正文


PHP app\Client类代码示例

本文整理汇总了PHP中app\Client的典型用法代码示例。如果您正苦于以下问题:PHP Client类的具体用法?PHP Client怎么用?PHP Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update(Client $client, ClientRequest $request)
 {
     //Client $client refrences a Route Model Binding method found is RouteServiceProvider.php
     $client->update($request->all());
     \Session::flash('flash_message', 'Client ' . $client->first_name . ' ' . $client->last_name . ' was updated.');
     return redirect('clients');
 }
开发者ID:patrykszady,项目名称:gstest,代码行数:7,代码来源:ClientsController.php

示例2: create

 /**
  * Handle creation of new bill.
  *
  * @param CreateBillRequest $request
  * @return array
  */
 public function create(CreateBillRequest $request)
 {
     // Save request data
     $clientName = $request->get('client');
     $useCurrentCampaign = $request->get('use_current_campaign');
     $campaignYear = $request->get('campaign_year');
     $campaignNumber = $request->get('campaign_number');
     $client = DB::table('clients')->where('name', $clientName)->where('user_id', Auth::user()->id)->first();
     // Create new client if not exists
     if (!$client) {
         $client = new Client();
         $client->user_id = Auth::user()->id;
         $client->name = $clientName;
         $client->save();
     }
     // Create new bill
     $bill = new Bill();
     $bill->client_id = $client->id;
     $bill->user_id = Auth::user()->id;
     $campaign = Campaigns::current();
     // Check if current campaign should be used
     if (!$useCurrentCampaign) {
         $campaign = Campaign::where('year', $campaignYear)->where('number', $campaignNumber)->first();
     }
     $bill->campaign_id = $campaign->id;
     $bill->campaign_order = Campaigns::autoDetermineOrderNumber($campaign, $client->id);
     $bill->save();
     event(new UserCreatedNewBill(Auth::user()->id, $bill->id));
     // Return response
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('bills.bill_created'));
     return response($response->get());
 }
开发者ID:bitller,项目名称:nova,代码行数:39,代码来源:IndexController.php

示例3: submitOTP

 public function submitOTP(Request $request)
 {
     //get mobile number from user input
     $mobileNum = $request->input('mobile');
     //get user type from user input
     $userType = $request->input('userType');
     //set user email
     $userEmail = 'new_user@email.com';
     //set country code
     $countryCode = 61;
     //initial authentication API
     // $authy_api = new AuthyApi(config('services.authy.key'));
     $authy_api = new AuthyApi(config('services.authy.key'), 'http://sandbox-api.authy.com');
     //sandbox
     //register a user through email, cellphone, country_code
     $user = $authy_api->registerUser($userEmail, $mobileNum, $countryCode);
     //generate authentication token and send it to usser
     $sms = $authy_api->requestSms($user->id(), array("force" => "true"));
     if ($sms->ok()) {
         //check user exist or not
         $results = Client::where('mobile', $mobileNum)->first();
         //if user does not exist, register of him
         if (empty($results)) {
             $newUser = new Client();
             $newUser->mobile = $mobileNum;
             $newUser->save();
         }
         return view('auth.otp')->with('userid', $user->id())->with('mobileNum', $mobileNum)->with('userType', $userType);
     } else {
         //session()->put('message','incorrect mobile number');
         return redirect('login')->with('message', 'Please input correct mobile number');
     }
 }
开发者ID:J-Guo,项目名称:paydate,代码行数:33,代码来源:AuthController.php

示例4: testClientSave

 public function testClientSave()
 {
     $client = new Client();
     $client->name = 'Idea7';
     $client->country = 'IN';
     $client->status = 'active';
     if (!$client->save()) {
         $errors = $client->getErrors()->all();
         echo 'Client Insert failed' . print_r($errors);
         $this->assertTrue(false);
     } else {
         $this->assertTrue(true);
     }
 }
开发者ID:komalsavla10,项目名称:timesheet,代码行数:14,代码来源:ClientTest.php

示例5: destroy

 public function destroy($id)
 {
     $client = Client::find($id);
     $client->delete();
     $clients = Client::all();
     return view('client.list')->with(['success' => 'Cliente excluído com sucesso!', 'clients' => $clients]);
 }
开发者ID:Bryzola,项目名称:hiring,代码行数:7,代码来源:ClientController.php

示例6: edit

 public function edit($id)
 {
     $access = Access::findOrFail($id);
     $client = Client::all()->lists('name', 'id');
     $selected = array();
     return view('access.edit', compact('access', 'client', 'selected'));
 }
开发者ID:jdiaz1989,项目名称:intranet,代码行数:7,代码来源:AccessController.php

示例7: handleAction

 public function handleAction(Request $request)
 {
     $action = $request->input('_action');
     if ($action == 'createClient') {
         //Creation :
         Client::create($request->all());
         // FLash messaging :
         flash()->success('Opération réussie!', 'Client créé avec succès.');
     } else {
         if ($_POST['_action'] == 'getClientByID') {
             $id = $_POST['_uid'];
             $client = Client::where('id', $id)->with('files')->first();
             return response(['status' => 'success', 'client' => $client], 200);
         } else {
             if ($_POST['_action'] == 'editClient') {
                 $id = $_POST['id'];
                 $client = Client::find($id);
                 $client->lastname = $_POST['lastname'];
                 $client->firstname = $_POST['firstname'];
                 $client->email = $_POST['email'];
                 $client->street = $_POST['street'];
                 $client->postal_code = $_POST['postal_code'];
                 $client->city = $_POST['city'];
                 $client->vat = $_POST['tva'];
                 $client->mobile = $_POST['mobile'];
                 $client->office = $_POST['office'];
                 $client->fax = $_POST['fax'];
                 $client->save();
                 flash()->success('Opération réussie!', 'Client modifé avec succès.');
             } else {
             }
         }
     }
     return redirect('/clients');
 }
开发者ID:ninir007,项目名称:Ats,代码行数:35,代码来源:ClientsController.php

示例8: name

 /**
  *  Get the name of the user
  */
 public function name()
 {
     if ($this->Type == 1) {
         return Worker::find($this->TypeId)->Name;
     }
     return Client::find($this->TypeId)->Name;
 }
开发者ID:patrickdamery,项目名称:Eirene,代码行数:10,代码来源:User.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param RentalAgreement $agreement
  * @return Response
  * @internal param int $id
  */
 public function show(RentalAgreement $agreement)
 {
     $address = Address::find($agreement->property_id);
     $client = Client::find($agreement->client_id);
     $owner = Client::find($agreement->owner_id);
     return view('agreement.showAgreement', compact('agreement', 'address', 'client', 'owner'));
 }
开发者ID:arianpour,项目名称:AgentProV0.6,代码行数:14,代码来源:RentalAgreementController.php

示例10: clientsByName

 static function clientsByName()
 {
     $clients = Client::orderBy('name')->get(['id', 'name'])->getDictionary();
     return array_map(function ($client) {
         return $client->name;
     }, $clients);
 }
开发者ID:sethphillips,项目名称:event_mailer,代码行数:7,代码来源:User.php

示例11: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $client = false;
     if ($this->method() == 'PATCH') {
         $routeAction = $this->route()->getAction();
         $routeParameters = $this->route()->parameters();
         $cid = false;
         if (isset($routeParameters['clientId'])) {
             $cid = $routeParameters['clientId'];
         } else {
             if (isset($routeParameters['one'])) {
                 $cid = $routeParameters['one'];
             }
         }
         $client = \App\Client::find($cid);
         if (!$client) {
             dd('error');
         }
     }
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'PUT':
             return ['name' => 'required|unique:clients,name'];
         case 'PATCH':
             return ['name' => 'required|unique:clients,name,' . $client->id];
         default:
             return [];
             break;
     }
 }
开发者ID:kilrizzy,项目名称:laraticket,代码行数:37,代码来源:ClientFormRequest.php

示例12: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $client = Client::findOrFail($id);
     $addressId = $client->addresses()->first()->id;
     $address = Address::findOrFail($addressId);
     return view('editAddress', compact('address', 'client'));
 }
开发者ID:arianpour,项目名称:AgentProV0.2,代码行数:13,代码来源:AddressController.php

示例13: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('client', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Client::findOrFail($id);
     });
     $router->bind('bank', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return BankDetail::findOrFail($id);
     });
     $router->bind('address', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Address::findOrFail($id);
     });
     $router->bind('property', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Property::findOrFail($id);
     });
     $router->bind('agreement', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return RentalAgreement::findOrFail($id);
     });
     //
 }
开发者ID:arianpour,项目名称:AgentProV0.6,代码行数:36,代码来源:RouteServiceProvider.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = Client::findOrFail($id);
     $name = $client->name . " " . $client->lastname;
     Client::destroy($id);
     return redirect(route('clients.index'))->with('message', 'Cliente ' . $name . ' eliminado corectamente');
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:12,代码来源:ClientController.php

示例15: clientsForUser

 public function clientsForUser($user = null)
 {
     if ($user != null) {
         return \App\Client::where('user_id', $user->id)->get();
     }
     return \App\Client::where('user_id', $this->user()->id)->get();
 }
开发者ID:Jemok,项目名称:skoolspace,代码行数:7,代码来源:Controller.php


注:本文中的app\Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。