1

I am having difficulties to get that working properly, there's probably an error with the way i am trying to pass the id variable to the method. I am using Laravel.

My view contains this form to handle the function and pass the id:

{{ Form::open(array('method' => 'GET', 'url' => array('uploads/edit', $upload->id))) }}
    {{ Form::submit('Edit', array('class' => 'btn btn-info')) }}
{{ Form::close() }}

Controller:

public function getEdit($id)
{
  $upload = $this->upload->find($id);

  if (is_null($upload))
  {
  return Redirect::to('uploads/alluploads');
  }

  $layout->layout->content = View::make('uploads.edit', compact('upload'));
}

Error:

ErrorException
Creating default object from empty value

1 Answer 1

3

The error is here;

$layout->layout->content = ....

You can't do that, as you don't have $layout defined, or $layout->layout. Try:

 $layout = View::make('uploads.edit', compact('upload'));

or if you are really keen to have it exactly like your code is now, you can do this;

$layout = new stdClass();
$layout->layout = new stdClass();

$layout->layout->content = View::make('uploads.edit', compact('upload'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.