Answer the question
In order to leave comments, you need to log in
Why is an array created?
This code writes an array to the active variable.
public function store(Request $request)
{
//dd($request->all());
$act= $request->input('active');
if ($act == 'on') {
$act='1';
} elseif ($act == null) {
$act='0';
}
$User = new User();
$User->name = $request->input('name');
$User->email = $request->input('email');
$User->password = $request->input('password') ;
$User->tel = $request->input('tel');
$User->active = $act;
dd($User);
//$User->save();
Flash::success('Пользователь добавлен.');
return redirect('admin/user');
}
Answer the question
In order to leave comments, you need to log in
public function store(Request $request)
{
//dd($request->all());
$act= $request->input('active')[0];
if ($act == 'on') {
$act='1';
} else {
$act='0';
}
$User = new User();
$User->name = $request->input('name');
$User->email = $request->input('email');
$User->password = $request->input('password') ;
$User->tel = $request->input('tel');
$User->active = $act;
dd($User);
//$User->save();
Flash::success('Пользователь добавлен.');
return redirect('admin/user');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question