Blade template:
{!! Form::model($category) !!}
{!! Form::select('drinks_id', [...full list...]) !!}
{!! Form::close() !!}
'drinks_id'
called by Eloquent Accessor:
public function getDrinksIdAttribute()
{
var_dump('get');
return 123;
}
When Form::select('drinks_id')
execute, getDrinksIdAttribute()
called twice and print string(3) "get" string(3) "get"
from var_dump()
.
If I write this:
{!! Form::model($category) !!}
{!! var_dump($category->drinks_id) !!}
{!! Form::close() !!}
it called getDrinksIdAttribute()
once.
This is Form::select()
bug, or I do something wrong?
FormBuilder
useobject_get()
helper function for get value from model:object_get()
called Eloquent Accessor twice:The solution: