Skip to content

Commit

Permalink
category routes
Browse files Browse the repository at this point in the history
  • Loading branch information
danivideda committed Dec 8, 2020
1 parent f055ab4 commit e98dd6f
Show file tree
Hide file tree
Showing 22 changed files with 294 additions and 169 deletions.
161 changes: 161 additions & 0 deletions app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class CategoryController extends Controller
{
public function index($grade, $subject) {
if ($grade == '10') {
if ($subject == 'fisika') {
return $this->tenthGradeFisika();
}

if ($subject == 'matematika') {
return $this->tenthGradeMatematika();
}

if ($subject == 'kimia') {
return $this->tenthGradeKimia();
}

if ($subject == 'biologi') {
return $this->tenthGradeBiologi();
}

if ($subject == 'indonesia') {
return $this->tenthGradeIndonesia();
}

if ($subject == 'inggris') {
return $this->tenthGradeInggris();
}

} else if ($grade == '11') {
if ($subject == 'fisika') {
return $this->eleventhGradeFisika();
}

if ($subject == 'matematika') {
return $this->eleventhGradeMatematika();
}

if ($subject == 'kimia') {
return $this->eleventhGradeKimia();
}

if ($subject == 'biologi') {
return $this->eleventhGradeBiologi();
}

if ($subject == 'indonesia') {
return $this->eleventhGradeIndonesia();
}

if ($subject == 'inggris') {
return $this->eleventhGradeInggris();
}

} else if ($grade == '12') {
if ($subject == 'fisika') {
return $this->twelfthGradeFisika();
}

if ($subject == 'matematika') {
return $this->twelfthGradeMatematika();
}

if ($subject == 'kimia') {
return $this->twelfthGradeKimia();
}

if ($subject == 'biologi') {
return $this->twelfthGradeBiologi();
}

if ($subject == 'indonesia') {
return $this->twelfthGradeIndonesia();
}

if ($subject == 'inggris') {
return $this->twelfthGradeInggris();
}

} else {
return "Something went wrong.";
}
}

private function tenthGradeFisika() {
return view('categories.kelas10.fisika');
}

private function tenthGradeMatematika() {
return view('categories.kelas10.matematika');
}

private function tenthGradeKimia() {
return view('categories.kelas10.kimia');
}

private function tenthGradeBiologi() {
return view('categories.kelas10.biologi');
}

private function tenthGradeIndonesia() {
return view('categories.kelas10.indonesia');
}

private function tenthGradeInggris() {
return view('categories.kelas10.inggris');
}

private function eleventhGradeFisika() {
return view('categories.kelas11.fisika');
}

private function eleventhGradeMatematika() {
return view('categories.kelas11.matematika');
}

private function eleventhGradeKimia() {
return view('categories.kelas11.kimia');
}

private function eleventhGradeBiologi() {
return view('categories.kelas11.biologi');
}

private function eleventhGradeIndonesia() {
return view('categories.kelas11.indonesia');
}

private function eleventhGradeInggris() {
return view('categories.kelas11.inggris');
}

private function twelfthGradeFisika() {
return view('categories.kelas12.fisika');
}

private function twelfthGradeMatematika() {
return view('categories.kelas12.matematika');
}

private function twelfthGradeKimia() {
return view('categories.kelas12.kimia');
}

private function twelfthGradeBiologi() {
return view('categories.kelas12.biologi');
}

private function twelfthGradeIndonesia() {
return view('categories.kelas12.indonesia');
}

private function twelfthGradeInggris() {
return view('categories.kelas12.inggris');
}
}
35 changes: 35 additions & 0 deletions database/migrations/2020_12_08_032953_create_courses_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCoursesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('courses', function (Blueprint $table) {
$table->id();
$table->string('course_name');
$table->string('category');
$table->string('grade');
$table->json('content');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('courses');
}
}
10 changes: 5 additions & 5 deletions resources/views/categories/kelas10/biologi.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand Down Expand Up @@ -161,4 +161,4 @@
</div>
</div>
</div>
@endsection
@endsection
10 changes: 5 additions & 5 deletions resources/views/categories/kelas10/fisika.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand Down Expand Up @@ -171,4 +171,4 @@
</div>
</div>
</div>
@endsection
@endsection
10 changes: 5 additions & 5 deletions resources/views/categories/kelas10/indonesia.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand Down Expand Up @@ -171,4 +171,4 @@
</div>
</div>
</div>
@endsection
@endsection
10 changes: 5 additions & 5 deletions resources/views/categories/kelas10/inggris.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand Down Expand Up @@ -161,4 +161,4 @@
</div>
</div>
</div>
@endsection
@endsection
11 changes: 5 additions & 6 deletions resources/views/categories/kelas10/kimia.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand All @@ -27,7 +27,6 @@
</div>

<div class="w-7/12 flex flex-col items-center py-12 px-8 bg-gray-200" style="margin-left: 16.67%; margin-right: 25%">

<h1 class="text-5xl px-5 font-bold text-gray-800 w-full mb-16">Categories</h1>

<div class="px-5 flex justify-evenly w-1/2 mb-4">
Expand Down Expand Up @@ -172,4 +171,4 @@
</div>
</div>
</div>
@endsection
@endsection
10 changes: 5 additions & 5 deletions resources/views/categories/kelas10/matematika.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<div class="w-full flex">
<!-- Sidebar -->
<div class="w-2/12 h-screen flex flex-col items-center py-12 fixed top-0 left-0 z-10">
<a href="/" class="px-3 mb-12">
<a href="{{ route('landing') }}" class="px-3 mb-12">
<img src="{{asset('img/logo.PNG')}}" alt="Sqola" style="height: 45px;" class="mx-8">
</a>
<a href="/" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="/courses/ongoing" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="mx-3 px-10 py-2 text-white bg-blue-500 rounded-lg hover:bg-blue-700 mb-10"> Join a Course </a>
<a href="{{ route('course.ongoing') }}" class="my-2 py-2 w-full text-gray-400 hover:text-gray-800 hover:bg-gray-100 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-book-reader mr-2"></i>
<span>My Course</span>
</div>
</a>
<a href="/categories/10/fisika" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<a href="{{ route('category', ['10', 'fisika']) }}" class="my-2 py-2 w-full border-r-4 border-blue-500 font-medium">
<div class="mx-auto w-max">
<i class="fas fa-th-large mr-2"></i>
<span class="text-black">Categories</span>
Expand Down Expand Up @@ -166,4 +166,4 @@
</div>
</div>
</div>
@endsection
@endsection
Loading

0 comments on commit e98dd6f

Please sign in to comment.