本文整理汇总了PHP中Client::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::findOrFail方法的具体用法?PHP Client::findOrFail怎么用?PHP Client::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::findOrFail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified client in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$client = Client::findOrFail($id);
$validator = Validator::make($data = Input::all(), Client::rolesUpdate($client->id), Client::$messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$client->name = Input::get('name');
$client->contact_person = Input::get('cname');
$client->email = Input::get('email_office');
$client->contact_person_email = Input::get('email_personal');
$client->contact_person_phone = Input::get('mobile_phone');
$client->phone = Input::get('office_phone');
$client->address = Input::get('address');
$client->type = Input::get('type');
$client->save();
$client->update();
return Redirect::route('clients.index')->withFlashMessage('Client successfully updated!');
}
示例2: update
/**
* Update the specified client in storage.
*
* @param int $id
* @return Response
*/
public function update($bookingId, $id)
{
$client = Client::findOrFail($id);
$data = [];
$data['name'] = Input::get('name_' . $id);
$data['passport_number'] = Input::get('passport_number_' . $id);
$data['dob'] = Input::get('dob_' . $id);
$data['gender'] = Input::get('gender_' . $id);
$validator = Validator::make($data, Client::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if ($client->update($data)) {
Booking::emailBookingDetails($bookingId);
}
return Redirect::back();
}
示例3: update
/**
* Update the specified client in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$client = Client::findOrFail($id);
$user = Auth::getUser();
$validator = Validator::make($data = Input::all(), Client::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$client->name = Input::get('name');
$client->address_1 = Input::get('address_1');
$client->address_2 = Input::get('address_2');
$client->city = Input::get('city');
$client->zip = Input::get('zip');
$client->state = Input::get('state');
$client->country_id = Input::get('country_id');
$client->phone = Input::get('phone');
$client->mobile = Input::get('mobile');
$client->fax = Input::get('fax');
$client->email = Input::get('email');
$client->web = Input::get('web');
if (Input::hasFile('logo')) {
File::delete($client->image_path, $client->image_path_thumbnail);
$file = Input::file('logo');
$thumbnail = Image::make($file->getRealPath())->crop(200, 80);
$destinationPath = 'uploads/' . $user->username . "/clients/";
$filename_string = sha1(time() . time() . $file->getClientOriginalName());
$filename = $filename_string . "." . $file->getClientOriginalExtension();
$filename_thumb = $filename_string . "_thumb" . "." . $file->getClientOriginalExtension();
if (!File::exists($destinationPath)) {
mkdir($destinationPath, 0777, true);
}
$upload_success = Input::file('logo')->move($destinationPath, $filename) && $thumbnail->save($destinationPath . "/" . $filename_thumb);
if ($upload_success) {
$client->image_name = $file->getClientOriginalName();
$client->image_path = $destinationPath . $filename;
$client->image_path_thumbnail = $destinationPath . $filename_thumb;
}
}
$client->save();
return Redirect::to('clients/' . $client->id . '/edit')->with('success', Lang::get('clients.message.success.update'));
}
示例4: date
$erporder = new Erporder;
$erporder->date = date('Y-m-d', strtotime(array_get($data, 'date')));
$erporder->order_number = array_get($data, 'order_number');
$erporder->client()->associate($client);
$erporder->payment_type = array_get($data, 'payment_type');
$erporder->type = 'sales';
$erporder->save();
*/
$items = Item::all();
$locations = Location::all();
$taxes = Tax::all();
return View::make('erppurchases.purchaseitems', compact('items', 'locations', 'taxes', 'orderitems'));
});
Route::post('erpquotations/create', function () {
$data = Input::all();
$client = Client::findOrFail(array_get($data, 'client'));
/*
$erporder = array(
'order_number' => array_get($data, 'order_number'),
'client' => $client,
'date' => array_get($data, 'date')
);
*/
Session::put('erporder', array('order_number' => array_get($data, 'order_number'), 'client' => $client, 'date' => array_get($data, 'date')));
Session::put('quotationitems', []);
$orderitems = Session::get('quotationitems');
/*
$erporder = new Erporder;
$erporder->date = date('Y-m-d', strtotime(array_get($data, 'date')));
$erporder->order_number = array_get($data, 'order_number');
示例5: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
return View::make('clients.create')->with('client', Client::findOrFail($id))->with('title', 'Edit Client')->with('method', 'PUT')->with('url', 'clients/' . $id);
}
示例6: update
/**
* Update the specified booking in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$booking = Booking::findOrFail($id);
$validator = Validator::make($data = Input::all(), Booking::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$client = Client::findOrFail(Input::get('client_id'));
$car = Car::findOrFail(Input::get('car_id'));
$booking->client()->associate($client);
$booking->car()->associate($car);
$booking->destination = Input::get('destination');
$booking->date_out = Input::get('date_out');
$booking->date_back = Input::get('date_back');
$booking->update();
return Redirect::route('bookings.index');
}
示例7: printClient
public function printClient($id)
{
$client = Client::findOrFail($id);
$pdf = App::make('snappy.pdf.wrapper');
$html = <<<HTML
\t\t <html>
\t\t <head>
\t\t
\t\t <style type="text/css">
\t\t @font-face {
\t\t\t\t\t font-family: 'Neutra';
\t\t\t\t\t src: url('http://mosdb.bobbyholtzner.com/css/NeutraText-Bold.otf') format('opentype'); /* Safari, Android, iOS */
\t\t\t\t\t}
\t\t\t\t\t@font-face{
\t\t\t\t\t\tfont-family: 'NeutraText BookSC';
\t\t\t\t\t\tsrc:url('http://mosdb.bobbyholtzner.com/css/NeutraText BookSC.otf') format('opentype');
\t\t\t\t\t}
\t\t \tp{
\t\t \t\tfont-size: 12px;
\t\t \t\tfont-family: NeutraText BookSC;
\t\t \t\t
\t\t \t}
\t\t \t.bold{
\t\t \t\tfont-weight: 700;
\t\t \t\tfont-family: Neutra;
\t\t \t}
\t\t \theader{
\t\t \t\tcolor:#ED1B35;
\t\t \t\tfont-weight: bold;
\t\t \t\tmargin-bottom: 25px;
\t\t \t\tfont-family: Neutra;
\t\t \t}
\t\t </style>
\t\t </head>
\t\t <body>
<header>Projects for {$client->company} <br /></header>
HTML;
foreach ($client->projects as $project) {
$html .= '
<div class="playerPage">
<p><span class="bold">Project Service:</span> ' . $project->service . ' </p>
<p><span class="bold">Project Details:</span> ' . $project->details . '</p>
<p><span class="bold">Project Date:</span> ' . date("n/j/Y", strtotime($project->date)) . '</p>
<p><span class="bold">Project Amount:</span> ' . $project->amount . '</p>
<p><span class="bold">Contact Name:</span> ' . $project->contact_name . '</p>
<p><span class="bold">Contact Email:</span> ' . $project->contact_email . '</p>
<p><span class="bold">Contact Phone:</span> ' . $project->contact_phone . '</p>
<p><span class="bold">Project Notes: </span>' . $project->notes . '</p> <br />
';
}
// return PDF::loadHTML($html)->download('selected.pdf');
$pdf->loadHTML($html);
return $pdf->stream();
}