ErrorException (E_ERROR) Call to a member function diffForHumans() on string

Posted 3 months ago by behnampmdg3

Hi what's up it's Monday and I get this error.

I wanna show days since this has been a member and the exact date .

For example Member since March 15th 2019 (3 days)

View

{{ $course->created_at->diffForHumans() }}

Value in DB

2019-03-17 12:31:04

Controller

$courses = \DB::table('courses')
            ->join('member_course', 'courses.id', '=', 'member_course.course_id')
            ->join('members', 'members.id', '=', 'member_course.member_id')
            ->where('members.id', '=', $member->id)
            ->select('courses.title','courses.id','member_course.created_at')
            ->get();

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.