-1
當我處理創建信息的形式,我會做:Laravel 5形式要求
public function handlecreer(Requests\CreerUtilisateurRequest $request)
{
// handle create form
// all fields in one line... YEAH !!!
$user = new User($request->except('password','role'));
$user->password = bcrypt(Request::input('password'));
$user->save();
....}
但是,如果我有一個更新後的形式我會做:
public function handleUpdate(Requests\UpdateUtilisateurRequest $request)
{
// handle update form
$user = User::findOrFail(Request::input('id'));// find
// one line by field... BOH !!!
$user->name = Request::input('name');
$user->email = Request::input('email');
$user->password = bcrypt(Request::input('password'));
$user->telephone= Request::input('telephone');
$user->fonction = Request::input('fonction');
$user->divers = Request::input('divers');
$user->save();
....}
是否有處理更新帖子表單的最簡單方法是什麼?
感謝,
Paguemaou
你的答案非常感謝。它解決了我的問題。 – Paguemaou