Unsupported operand types in laravel

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

Unsupported operand types

and the line it shows is

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

      

and this is in my edit.blade.php

+3


source to share


2 answers


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'));

      

+1


source


In the controller, you haven't added the submenu options, for this reason it shows this error:



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

      

0


source







All Articles