diff --git a/app/Http/Controllers/Api/EventController.php b/app/Http/Controllers/Api/EventController.php new file mode 100644 index 0000000..9abedcd --- /dev/null +++ b/app/Http/Controllers/Api/EventController.php @@ -0,0 +1,67 @@ +get(); - - $designCategories = CourseCategory::whereIn('category_name', ['Graphics Desgin', 'Web Design', 'Video Editing'])->pluck('id')->toArray(); - $designCourses = Course::whereIn('course_category_id', $designCategories)->where('tag', 'popular')->get(); - - $developmentCategories = CourseCategory::whereIn('category_name', ['Web Development', 'Mobile Development', 'Game Development', 'Database Design & Development', 'Data Science'])->pluck('id')->toArray(); - $developmentCourses = Course::whereIn('course_category_id', $developmentCategories)->where('tag', 'popular')->get(); - - $businessCategories = CourseCategory::whereIn('category_name', ['Digital Marketing', 'Entrepreneurship'])->pluck('id')->toArray(); - $businessCourses = Course::whereIn('course_category_id', $businessCategories)->where('tag', 'popular')->get(); - - $itCategories = CourseCategory::whereIn('category_name', ['Hardware', 'Network Technology', 'Software & Security', 'Operating System & Server', '2D Animation', '3D Animation'])->pluck('id')->toArray(); - $itCourses = Course::whereIn('course_category_id', $itCategories)->where('tag', 'popular')->get(); - - return response($category, 200); - } -} diff --git a/app/Models/Event.php b/app/Models/Event.php new file mode 100644 index 0000000..cbd6b41 --- /dev/null +++ b/app/Models/Event.php @@ -0,0 +1,11 @@ +id(); + $table->string('title'); + $table->text('description'); + $table->string('location'); + $table->string('hosted_by'); + $table->timestamps(); // Created at and Updated at columns + $table->softDeletes(); // Deleted at column for soft deletes + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('events'); + } +}; diff --git a/routes/api.php b/routes/api.php index 917ec9f..2592ccf 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,7 +2,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; -use App\Http\Controllers\Api\HomeController as homectrl; +use App\Http\Controllers\Api\EventController as event; /* |-------------------------------------------------------------------------- @@ -19,4 +19,4 @@ return $request->user(); }); -Route::get('/',[homectrl::class,'index']); \ No newline at end of file +Route::get('/',[event::class,'index']); \ No newline at end of file