Why is in the view laravel 5.x. swears by isset($var)?

Good day,

This problem has aincludes the form of


{!! Form::open(['url'=>'admin/articles']) !!}

 @include('articles._form', ['submitButtonText' => Lang::get('messages.create')])

 {!! Form::close() !!}

and edit.blade.php:

{!! Form::model($article, ['method'=>'PATCH', 'action'=>['Admin\ArticlesController@update', $article->id]]) !!}

@include('articles._form', ['submitButtonText' => Lang::get('messages.update')])

{!! Form::close() !!}


{!! Form::input('date','published_at', isset($article) ? date('Y-m-d', strtotime($article->published_at)) : date('Y-m-d'), ['class'=>'form-control']) !!}

{!! Form::submit($submitButtonText, ['class'=>'btn btn-success form-control']) !!}

What the create action and contacted isset($article) :

ErrorException (E_ERROR)
Undefined variable: article (View: /var/www/dentex.loc/public_html/resources/views/articles/_form.blade.php) (View: /var/www/dentex.loc/public_html/resources/views/articles/_form.blade.php)

How can this be solved by framworks or antiquated?

Changed the way of opening forms in create.blade.php on:

{!! Form::model($article=null, ['method'=>'PATCH', 'url'=>'admin/articles']) !!}

The result gave. But that sounds like a good solution.
June 10th 19 at 15:35
1 answer
June 10th 19 at 15:37
Look at yourself, there's the variable "$to view the article2 in". And MB is better to check through "!empty" than "isset"...
Thank you.

The variable might not exist if the action is create. - dudley_Ri commented on June 10th 19 at 15:40

Find more questions by tags Laravel