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


PHP Client::find方法代码示例

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


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

示例1: create

 public function create($id)
 {
     $client = Client::find($id);
     //created new route /projects/create/{id}
     //$clients = Client::lists('first_name', 'id'); //sends an array of  'first_name' => 'id'
     return view('projects.create', compact('client'));
 }
开发者ID:patrykszady,项目名称:gstest,代码行数:7,代码来源:ProjectsController.php

示例2: 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

示例3: 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

示例4: index

 /**
  * Display a listing of client's albums.
  *
  * @return Response
  */
 public function index($id)
 {
     $client = Client::find($id);
     $albums = $client->albums;
     $title = $client->first_name . ' ' . $client->last_name . ' Albums';
     return view('admin.client_albums_index')->with('title', $title)->with('id', $id)->with('albums', $albums);
 }
开发者ID:2dan-devs,项目名称:williamnavasphoto,代码行数:12,代码来源:ClientAlbumsController.php

示例5: 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

示例6: 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

示例7: 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

示例8: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request, $client_id = null)
 {
     $project_client = Client::find($client_id);
     $clients = $request->user()->clients;
     $view = $request->ajax() ? 'projects.create-modal' : 'projects.create';
     return view($view, compact('clients', 'client_id'))->with(['client' => @$project_client]);
 }
开发者ID:system3d,项目名称:consultas-tecnicas,代码行数:12,代码来源:ProjectController.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $client = Client::findOrFail($id);
     $projects = Client::find($id)->projects()->orderBy('id', 'desc')->get();
     $invoices = Client::find($id)->invoices()->orderBy('id', 'desc')->get();
     $quotes = Client::find($id)->quotes()->orderBy('id', 'desc')->get();
     $client->client_id = $client->id + 999;
     foreach ($invoices as $invoice) {
         $issue_date = Carbon::parse($invoice->issue_date);
         $due_date = Carbon::parse($invoice->due_date);
         $now = Carbon::now();
         if ($now > $due_date) {
             $invoice->is_overdue = true;
         } else {
             $invoice->is_overdue = false;
         }
         $invoice->readable_specific_id = $invoice->client_specific_id;
         if ($invoice->client_specific_id < 10) {
             $invoice->readable_specific_id = sprintf("%02d", $invoice->client_specific_id);
         }
         $invoice->terms_diff = $issue_date->diffInDays($due_date);
     }
     foreach ($quotes as $quote) {
         if ($quote->client_specific_id < 10) {
             $quote->client_specific_id = sprintf("%02d", $quote->client_specific_id);
         }
     }
     foreach ($projects as $project) {
         $project->latest_activity = $project->project_activity()->latest()->first();
     }
     $totalPaid = $client->invoices()->paid()->sum('amount');
     $totalOutstanding = $client->invoices()->active()->sum('amount');
     return view('app.client', ['client' => $client, 'projects' => $projects, 'invoices' => $invoices, 'quotes' => $quotes, "total_paid" => $totalPaid, 'total_outstanding' => $totalOutstanding]);
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:40,代码来源:ClientController.php

示例10: edit

 public function edit(Request $request, $id)
 {
     $client = \App\Client::find($id);
     $client->name = $request->input('name');
     $client->email = $request->input('email');
     $client->save();
     return redirect()->route('clients.details', $id);
 }
开发者ID:arochaoscar,项目名称:sias-otp,代码行数:8,代码来源:ClientController.php

示例11: comments

 public function comments()
 {
     $client_data = Client::find(Auth::user()->id);
     $branch_data = $client_data->branch()->first();
     //get the client branch information
     $comments = RestaurantFeedback::where('comment', '!=', '')->orderBy('id', 'desc')->take(6)->get();
     return view('client.comments', compact('branch_data', 'comments'));
 }
开发者ID:imrealashu,项目名称:emplace,代码行数:8,代码来源:DashboardController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ClientRequest $request, $id)
 {
     $Client = Client::find($id);
     $Client->fill($request->all());
     $Client->save();
     Flash::success('Se ha editado a ' . $Client->nombre . '.');
     return redirect()->route('clientes.index');
 }
开发者ID:jbachi,项目名称:appgestion,代码行数:15,代码来源:ClientController.php

示例13: delete

 /**
  * delete client
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function delete($id)
 {
     $client = Client::find($id);
     if ($client == null) {
         return response()->json(['error' => "Client not found"]);
     }
     $client->delete();
     return response()->json(['success' => "Client deleted"]);
 }
开发者ID:kamalludinega,项目名称:test,代码行数:14,代码来源:ClientController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = Client::find($id);
     if ($client->campaigns()->count()) {
         return redirect()->back()->with('error', "{$client->name} has active campaigns and cannot be deleted");
     }
     $client->delete();
     return redirect()->route('admin.clients.index')->with('message', "{$client->name} deleted.");
 }
开发者ID:sethphillips,项目名称:event_mailer,代码行数:15,代码来源:ClientController.php

示例15: deleteDelete

 public function deleteDelete($clientId)
 {
     $client = \App\Client::find($clientId);
     if (!$client) {
         \Flash::error('Client not found');
         return redirect('clients');
     }
     $client->delete();
     \Flash::success('Client Deleted');
     return redirect('clients');
 }
开发者ID:kilrizzy,项目名称:laraticket,代码行数:11,代码来源:ClientController.php


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