本文整理汇总了PHP中School::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP School::findOrFail方法的具体用法?PHP School::findOrFail怎么用?PHP School::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
$school = School::findOrFail($id);
$validator = Validator::make($data = Input::all(), School::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$school->update($data);
return Redirect::route('user.profile.index')->with("successMessage", "Data Sekolah Berhasil di Update")->withTitle('Profile');
}
示例2: update
public function update($id)
{
$school = School::findOrFail($id);
$school->name = Input::get('name');
$school->address = Input::get('address');
$school->contact = Input::get('contact');
$school->contact_person = Input::get('contact_person');
$school->level = Input::get('level');
$school->save();
Session::flash('message', 'Sukses mengupdate Sekolah!');
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
$school = School::findOrFail($id);
return view('layouts.schoolprofile', ['school' => $school]);
}
示例4: update
/**
* Update the specified school in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$school = School::findOrFail($id);
$validator = Validator::make($data = Input::all(), School::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$school->update($data);
return Redirect::route('schools.index');
}