Php – Get todays current date automatically in form in laravel 5

datelaravelphp

I want to display todays date in date_created field when clicked to create page.

{!! Form::open(['route'=>'articles.store'])!!}
        <div class="form-group">
           <label><b>DATE CREATED</b></label>
           {!! Form::text('date_created',null,array('class'=>'form-control date-picker')) !!}
        </div>
        {!! form::submit('Add',[' class'=>'btn btn-primary form-control'])!!}
{!! Form::close()!!}

Best Solution

You can use

{!! Form::text('date_created', 
    old('date_created', 
        Carbon\Carbon::today()->format('Y-m-d')),
    ['class'=>'form-control date-picker']) !!}