In%%, I want, when a given value does not exist in Laravel
, I can set a default value.
With pure PHP, you can do this:
$text = isset($_POST['text']) ? $_POST['text'] : 'padrão';
In Laravel I know it's possible to do something like this:
$text = Input::has('text') ? Input::get('text') : 'padrão';
Given that Input
is an excellent framework with some features that slow down continuous code rewriting, is there an easier way to get a stop value for an input value? Or is this the only way out?
Sometimes it gets tiresome to do:
$a = Input::has('a') ? Input::get('a') : 'Valor padrão';
$b = Input::has('b') ? Input::get('b') : 'Valor padrão';
$c = Input::has('c') ? Input::get('c') : 'Valor padrão';