Skip to content

Instantly share code, notes, and snippets.

@omarkdev
Created May 15, 2017 19:08
Show Gist options
  • Save omarkdev/9d15ed0209f59c3314b8030782727186 to your computer and use it in GitHub Desktop.
Save omarkdev/9d15ed0209f59c3314b8030782727186 to your computer and use it in GitHub Desktop.
<?php
public function show($slug)
{
$lesson = $this->repository->findBySlug($slug);
if ($lesson) {
$this->addThumbToImages($lesson->thumb_url);
$trackTitle = ! $lesson->track ? '' : '['.$lesson->track->title.']';
$this->seo()->setTitle($lesson->title . $trackTitle);
$this->seo()->setDescription($lesson->description);
return $this->view('lessons::show')->with(compact('lesson'));
}
return redirect(route('lesson.index'));
}
protected function addThumbToImages($thumbURL)
{
if (empty($thumbURL)) {
return false;
}
return $this->seo()->addImages($thumbURL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment