added event
Cette révision appartient à :
Parent
2334533ce1
révision
0a8aa3ed69
67
app/Http/Controllers/Api/EventController.php
Fichier normal
67
app/Http/Controllers/Api/EventController.php
Fichier normal
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$event = Event::get();
|
||||
return response($event, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Event $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Course;
|
||||
use App\Models\Instructor;
|
||||
use App\Models\CourseCategory;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$course = Course::get();
|
||||
$instructor = Instructor::get();
|
||||
$category = CourseCategory::get();
|
||||
$popularCourses = Course::where('tag', 'popular')->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);
|
||||
}
|
||||
}
|
||||
11
app/Models/Event.php
Fichier normal
11
app/Models/Event.php
Fichier normal
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
33
database/migrations/2024_01_03_073449_create_events_table.php
Fichier normal
33
database/migrations/2024_01_03_073449_create_events_table.php
Fichier normal
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('events', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
||||
@ -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']);
|
||||
Route::get('/',[event::class,'index']);
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user