giorg
1 year ago

undefined offset 0

Posted 1 year ago by giorg

Hi,

in my controller doing this:

public function store() { $input = Request::all();

$game = new Game;
$game->name = $input['name'];
$game->enabled = ($input['enabled' === 'on']) ? 1 : 0;

$game->save();

}

at the enabled row I get undefined offset 0, tried also

if ($input['enabled' === 'on']) $game->enabled = 1

same error. Point is in the form I have a checkbox, while in the database I have a boolean. Any hint?

thanks

Please sign in or create an account to participate in this conversation.