Chibi
Chibi

Reputation: 103

Unsupported operand types in laravel

When I click on a menu to edit I get this error

Unsupported operand types

and the line that it shows is

{{ Form::select('submenu_id', array('default' => 'Please Select') + $submenu_options ) }}

and that is in my edit.blade.php

Upvotes: 3

Views: 11492

Answers (2)

sanu
sanu

Reputation: 1068

In Laravel 5.1 i solved it by doing

$categories = [''=>''] + Category::lists('name', 'id')->toArray();
return view('products.create', compact('categories'));

Or

$categories = [''=>''] + Category::lists('name', 'id')->all();
return view('products.create', compact('categories'));

Upvotes: 1

Nilesh Chourasia
Nilesh Chourasia

Reputation: 408

In controller you have not added submenu options, because of that reason it is showing this error :

return View::make('modulename.form')
    ->with('editMode', true)
    ->with('submenu_options','')
    ->with('customFields', $this->customField->getByTable('tablename'));

Upvotes: 0

Related Questions