问题
This strange thing is happening to me.I have the code below :
$state_image =States_Images::where('id_state', $id);
echo $delete_path=$state_image->name;
and the result is :
Undefined property: Illuminate\Database\Eloquent\Builder::$name
Someone help me pls :(
回答1:
You need to finish the query with get() or first(). In your case probably:
States_Images::where('id_state', $id)->first();
来源:https://stackoverflow.com/questions/37144564/undefined-property-illuminate-database-eloquent-builder