本文整理汇总了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');
}