本文整理汇总了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'));
}
示例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');
}
示例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]);
}
示例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);
}
示例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'));
}
示例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;
}
示例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;
}
}
示例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]);
}
示例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]);
}
示例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);
}
示例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'));
}
示例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');
}
示例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"]);
}
示例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.");
}
示例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');
}