/** * @param Course $course * @return bool */ public function isAuthor(Course $course) { $authorId = $course->author()->get()->first()->id; if ($authorId == Auth::user()->id) { return true; } return false; }
/** * @param Course $course * @return string */ public static function getAuthorFullName(Course $course) { $author = $course->author()->get()->first(); return $author->name . ' ' . $author->last_name; }