L5: Call to a member function function() on a non-object

Got a resourceful controller with a __contruct function to declare $project

 public function __construct(Project $project){

    $this->project = $project;

Then I have an update and a destroy function which gives an
Call to a member function delete() on a non-object (or update() error)

 public function edit($id)
    $project = $this->project->find($id);
    return view('project.edit', ['project' => $project, 'id' => 'edit']);

public function update(CreateProjectRequest $request, $project)

    return redirect('project/index');

public function destroy($project)
    return redirect('project');

What am I doing wrong?

Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.