Skip to content

Commit

Permalink
Course details page
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius-K committed Oct 30, 2019
1 parent 2efe583 commit 5932c73
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 8 deletions.
12 changes: 11 additions & 1 deletion app/Http/Controllers/CourseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ public function index()
$courses = Course::searchResults()
->paginate(6);

return view('courses', compact('courses'));
$breadcrumb = "Courses";

return view('courses.index', compact(['courses', 'breadcrumb']));
}

public function show(Course $course)
{
$course->load('institution');
$breadcrumb = $course->name;

return view('courses.show', compact(['course', 'breadcrumb']));
}
}
10 changes: 10 additions & 0 deletions public/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<img src="{{ optional($course->photo)->getUrl() ?? asset('img/no_image.png') }}" class="special_img" alt="">
<div class="special_cource_text">
@foreach($course->disciplines as $discipline)
<a href="course-details.html" class="btn_4 mr-1 mb-1">{{ $discipline->name }}</a>
<a href="{{ route('courses.index') }}?discipline={{ $discipline->id }}" class="btn_4 mr-1 mb-1">{{ $discipline->name }}</a>
@endforeach
<h4>{{ $course->getPrice() }}</h4>
<a href="course-details.html"><h3>{{ $course->name }}</h3></a>
<a href="{{ route('courses.show', $course->id) }}"><h3>{{ $course->name }}</h3></a>
<p>{{ Str::limit($course->description, 100) }}</p>
@if($course->institution)
<div class="author_info">
Expand Down
46 changes: 46 additions & 0 deletions resources/views/courses/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@extends('layouts.main')

@section('content')

<section class="course_details_area section_padding">
<div class="container">
<div class="row">
<div class="col-lg-8 course_details_left">
<div class="main_image">
<img class="img-fluid" src="{{ optional($course->photo)->getUrl() ?? asset('img/no_image.png') }}" alt="">
</div>
<div class="content_wrapper">
<h4 class="title_top">Description</h4>
<div class="content">
{{ $course->description ?? 'No description provided' }}
</div>
</div>
</div>


<div class="col-lg-4 right-contents">
<div class="sidebar_top">
<ul>
@if($course->institution)
<li>
<a class="justify-content-between d-flex">
<p>Institution</p>
<span class="color">{{ $course->institution->name }}</span>
</a>
</li>
@endif
<li>
<a class="justify-content-between d-flex">
<p>Course Fee </p>
<span>{{ $course->getPrice() }}</span>
</a>
</li>

</ul>
<a href="#" class="btn_1 d-block">Enroll the course</a>
</div>
</div>
</div>
</div>
</section>
@endsection
4 changes: 2 additions & 2 deletions resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<img src="{{ optional($course->photo)->getUrl() ?? asset('img/no_image.png') }}" class="special_img" alt="">
<div class="special_cource_text">
@foreach($course->disciplines as $discipline)
<a href="course-details.html" class="btn_4 mr-1 mb-1">{{ $discipline->name }}</a>
<a href="{{ route('courses.index') }}?discipline={{ $discipline->id }}" class="btn_4 mr-1 mb-1">{{ $discipline->name }}</a>
@endforeach
<h4>{{ $course->getPrice() }}</h4>
<a href="course-details.html"><h3>{{ $course->name }}</h3></a>
<a href="{{ route('courses.show', $course->id) }}"><h3>{{ $course->name }}</h3></a>
<p>{{ Str::limit($course->description, 100) }}</p>
@if($course->institution)
<div class="author_info">
Expand Down
2 changes: 2 additions & 0 deletions resources/views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<body>
@include('partials.header')

@includeWhen($breadcrumb ?? null, 'partials.breadcrumb')

@yield('content')

@include('partials.footer')
Expand Down
14 changes: 14 additions & 0 deletions resources/views/partials/breadcrumb.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<section class="breadcrumb breadcrumb_bg">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="breadcrumb_iner text-center">
<div class="breadcrumb_iner_item">
<h2>{{ $breadcrumb }}</h2>
<p><a href="{{ route('home') }}">Home</a><span>/</span><a href="{{ url()->current() }}">{{ $breadcrumb }}</a></p>
</div>
</div>
</div>
</div>
</div>
</section>
5 changes: 3 additions & 2 deletions resources/views/partials/header.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<header class="main_menu home_menu">
<header class="main_menu {{ isset($breadcrumb) ? 'single_page_menu' : 'home_menu' }}">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-12">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="{{ route('home') }}"> <img src="{{ asset('img/logo.png') }}" alt="logo"> </a>
<a class="navbar-brand logo_1" href="{{ route('home') }}"> <img src="{{ asset('img/single_page_logo.png') }}" alt="logo"> </a>
<a class="navbar-brand logo_2" href="{{ route('home') }}"> <img src="{{ asset('img/logo.png') }}" alt="logo"> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Auth::routes(['register' => false]);

Route::get('/', 'HomeController@index')->name('home');
Route::resource('courses', 'CourseController')->only(['index']);
Route::resource('courses', 'CourseController')->only(['index', 'show']);

Route::group(['prefix' => 'admin', 'as' => 'admin.', 'namespace' => 'Admin', 'middleware' => ['auth']], function () {
Route::get('/', 'HomeController@index')->name('home');
Expand Down

0 comments on commit 5932c73

Please sign in to comment.