當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。