php - Missing argument 1 error in laravel5.1

939

I don't know why I'm getting this error because I believe that my code should work fine. Please see my code below:

Controller

public function view($id){
  $course = Course::find($id);

  return view('course.view', compact('course'));
}

Model

protected $fillable = ['deleted'];

View

@if($course->deleted == 0)
  <h2>Not Deleted</h2>
@endif

Error:

Missing argument 1 for Illuminate\Database\Eloquent\Model::deleted(), called in .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 2670 and defined (View: .../Courses/Resources/views/courses/view.blade.php)

186

Answer

Solution:

Check it

@if($course->deleted() == 0)
  <h2>Not Deleted</h2>
@endif

People are also looking for solutions to the problem: html - How to open an excel file in a browser on anchor button click in php

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.