Request returning Decimal

0

I have a field in a form that is type text and when I give a post in the form and I get the request-> get this field returns string when there is some letter in it. but if it contains numbers it returns in reqeust-> get as decimal.

How do I make it always return string even when it's just number?

 {!! Form::text('background', NULL, ['class'=>'form-control', 'maxlength'=>'6', 'id' => 'background']) !!}

If I fill in with eg 007788 dd ($ request-> get ('background')); back like 7788.00 there if I put a07788 the dd ($ request-> get ('background')); returns a07788

Thank you

    
asked by anonymous 29.02.2016 / 20:02

1 answer

0

Cast for the type you want:

  • String

    dd((string) $request->get('background'))

  • Integer

    dd((int) $request->get('background'));

06.04.2016 / 17:34