Andrew Vanusi Andrew Vanusi - 10 months ago 93
PHP Question

How to save checkbox value to database Laravel

here's my form code :

<div class="form-group">
{{ Form::checkbox('warranty', 0, false) }}

here's my controller code :

public function save(Request $request, $obj = null) {

if (!$obj) {
$obj = new Service;
(Input::has('warranty')) ? true : false;
return $this->saveHandler($request, $obj);

it throws this error Class 'App\Http\Controllers\Input' not found

any idea ?

Answer Source

You can use request object to get the warranty input as: