Support the ongoing development of Laravel.io →
Database Forms

Hi

is it possible to have only one blade for create and edit?

I have try to implement and i am stack when define the value of a form element

{{ Form::label('title', 'Title', array('class' => '')) }}
{{ Form::text('title' , Input::old('title', $dataset->title) , array('class' => 'form-control')) }}

When comes the edit the $dataset->title is set from the model and its working fine

When comes the create no object $dataset exist and must set manual the $dataset->title to null to avoid the errors

Is it possible to create a $dataset object with all values to null based on the model

Is there any other way, i am new to Laravel

Thanks

Last updated 3 years ago.
0

This might work

<input type="text" {{ isset($dataset) ? 'value="$dataset->title"' : 'placeholder=""' }} />
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ntanas72 ntanas72 Joined 12 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.