本文整理匯總了PHP中Organization::findOrFail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Organization::findOrFail方法的具體用法?PHP Organization::findOrFail怎麽用?PHP Organization::findOrFail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Organization
的用法示例。
在下文中一共展示了Organization::findOrFail方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
/**
* Update the specified organization in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$organization = Organization::findOrFail($id);
$validator = Validator::make($data = Input::all(), Organization::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$organization->update($data);
return Redirect::route('organizations.index');
}
示例2: statement
public function statement($id)
{
$account = Savingaccount::findOrFail($id);
$transactions = $account->transactions;
$credit = DB::table('savingtransactions')->where('savingaccount_id', '=', $account->id)->where('type', '=', 'credit')->sum('amount');
$debit = DB::table('savingtransactions')->where('savingaccount_id', '=', $account->id)->where('type', '=', 'debit')->sum('amount');
$balance = $credit - $debit;
$organization = Organization::findOrFail(1);
$pdf = PDF::loadView('pdf.statement', compact('transactions', 'organization', 'account', 'balance'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('statement.pdf');
}
示例3: receipt
public function receipt($id)
{
$transaction = Loantransaction::findOrFail($id);
$organization = Organization::findOrFail(1);
$pdf = PDF::loadView('pdf.loanreports.receipt', compact('transaction', 'organization'))->setPaper('a5')->setOrientation('potrait');
return $pdf->stream('receipt.pdf');
}
示例4: logo
public function logo($id)
{
if (Input::hasFile('logo')) {
$destination = public_path() . '/uploads/logo/';
$filename = str_random(12);
$ext = Input::file('logo')->getClientOriginalExtension();
$photo = $filename . '.' . $ext;
Input::file('logo')->move($destination, $photo);
$organization = Organization::findOrFail($id);
$organization->logo = $photo;
$organization->update();
}
//return Redirect::to('organizations');
}