Info and filtering by course tracks, table of content on chapter view with links and previous and next buttons.
This commit is contained in:
@@ -9,9 +9,9 @@ use Illuminate\Http\Request;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(string $track = null)
|
||||
{
|
||||
$courses = Course::with('chapters')->withCount('chapters')->get();
|
||||
$courses = Course::where('tracks', 'like', '%'.$track.'%')->with('chapters')->withCount('chapters')->get();
|
||||
|
||||
return view('index', compact(['courses']));
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class HtmlParser
|
||||
$course->thumbnail = $courseItem->first('img.course-list-item-img')->attr('src');
|
||||
$course->link = last(explode('/', $courseItem->first('a')->attr('href')));
|
||||
$course->status = $courseItem->attr('data-status');
|
||||
$course->tracks = $courseItem->attr('data-tracks');
|
||||
$course->course_id = $courseItem->attr('data-id');
|
||||
$course->numberofchapters = $courseItem->attr('data-chapter-count');
|
||||
$course->timeswatched = $courseItem->attr('data-times-watched');
|
||||
|
||||
@@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
* @property string $thumbnail
|
||||
* @property string $link
|
||||
* @property string $status
|
||||
* @property string $tracks
|
||||
* @property integer $numberofchapters
|
||||
* @property integer $timeswatched
|
||||
* @property Date $published_at
|
||||
@@ -28,6 +29,7 @@ class Course extends Model
|
||||
'thumbnail',
|
||||
'link',
|
||||
'status',
|
||||
'tracks',
|
||||
'numberofchapters',
|
||||
'timeswatched',
|
||||
'published_at',
|
||||
|
||||
Reference in New Issue
Block a user