diff --git a/app/Http/Controllers/Api/EventController.php b/app/Http/Controllers/Api/EventController.php index 9abedcd..e2ff89b 100644 --- a/app/Http/Controllers/Api/EventController.php +++ b/app/Http/Controllers/Api/EventController.php @@ -14,54 +14,21 @@ class EventController extends Controller public function index() { $event = Event::get(); + $data = array(); + if ($event) { + foreach ($event as $e) { + $data[] = array( + 'id' => $e->id, + 'title' => $e->title, + 'description' => $e->description, + 'image' => asset('public/uploads/event/' . $e->image), + 'location' => $e->location, + 'hosted_by' => $e->hosted_by, + 'date' => date("d", strtotime($e->date)), + ); + } + } 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) - { - // - } } diff --git a/database/migrations/2024_01_03_073449_create_events_table.php b/database/migrations/2024_01_03_073449_create_events_table.php index 942d9d2..a4a2d24 100644 --- a/database/migrations/2024_01_03_073449_create_events_table.php +++ b/database/migrations/2024_01_03_073449_create_events_table.php @@ -16,7 +16,10 @@ public function up(): void $table->string('title'); $table->text('description'); $table->string('location'); + $table->string('image')->nullable(); + $table->string('location'); $table->string('hosted_by'); + $table->date('date')->nullable(); $table->timestamps(); // Created at and Updated at columns $table->softDeletes(); // Deleted at column for soft deletes diff --git a/laravel_elearning.sql b/laravel_elearning.sql index c986d63..3169b30 100644 --- a/laravel_elearning.sql +++ b/laravel_elearning.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 --- Generation Time: Jan 03, 2024 at 08:55 AM +-- Generation Time: Jan 03, 2024 at 09:21 AM -- Server version: 10.4.27-MariaDB -- PHP Version: 8.2.0 @@ -221,8 +221,10 @@ CREATE TABLE `events` ( `id` bigint(20) UNSIGNED NOT NULL, `title` varchar(255) NOT NULL, `description` text NOT NULL, + `image` varchar(255) DEFAULT NULL, `location` varchar(255) NOT NULL, `hosted_by` varchar(255) NOT NULL, + `date` datetime DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL @@ -232,9 +234,9 @@ CREATE TABLE `events` ( -- Dumping data for table `events` -- -INSERT INTO `events` (`id`, `title`, `description`, `location`, `hosted_by`, `created_at`, `updated_at`, `deleted_at`) VALUES -(1, 'Event 1', 'Description for Event 1.', 'Location 1', 'Host 1', '2024-01-03 07:39:47', '2024-01-03 07:39:47', NULL), -(2, 'Event 2', 'Description for Event 2.', 'Location 2', 'Host 2', '2024-01-03 07:39:47', '2024-01-03 07:39:47', NULL); +INSERT INTO `events` (`id`, `title`, `description`, `image`, `location`, `hosted_by`, `date`, `created_at`, `updated_at`, `deleted_at`) VALUES +(1, 'Event 1', 'Description for Event 1.', '1.jpg', 'Location 1', 'Host 1', NULL, '2024-01-03 07:39:47', '2024-01-03 07:39:47', NULL), +(2, 'Event 2', 'Description for Event 2.', '02.jpg', 'Location 2', 'Host 2', NULL, '2024-01-03 07:39:47', '2024-01-03 07:39:47', NULL); -- -------------------------------------------------------- diff --git a/public/uploads/event/02.jpg b/public/uploads/event/02.jpg new file mode 100644 index 0000000..c91a108 Binary files /dev/null and b/public/uploads/event/02.jpg differ diff --git a/public/uploads/event/03.jpg b/public/uploads/event/03.jpg new file mode 100644 index 0000000..58f239a Binary files /dev/null and b/public/uploads/event/03.jpg differ diff --git a/public/uploads/event/1.jpg b/public/uploads/event/1.jpg new file mode 100644 index 0000000..c91a108 Binary files /dev/null and b/public/uploads/event/1.jpg differ diff --git a/public/uploads/event/10.jpg b/public/uploads/event/10.jpg new file mode 100644 index 0000000..3ea4302 Binary files /dev/null and b/public/uploads/event/10.jpg differ diff --git a/public/uploads/event/2.jpg b/public/uploads/event/2.jpg new file mode 100644 index 0000000..4bb7295 Binary files /dev/null and b/public/uploads/event/2.jpg differ diff --git a/public/uploads/event/3.jpg b/public/uploads/event/3.jpg new file mode 100644 index 0000000..2cb412c Binary files /dev/null and b/public/uploads/event/3.jpg differ diff --git a/public/uploads/event/4.jpg b/public/uploads/event/4.jpg new file mode 100644 index 0000000..2384f8d Binary files /dev/null and b/public/uploads/event/4.jpg differ diff --git a/public/uploads/event/5.jpg b/public/uploads/event/5.jpg new file mode 100644 index 0000000..7916a5f Binary files /dev/null and b/public/uploads/event/5.jpg differ diff --git a/public/uploads/event/6.jpg b/public/uploads/event/6.jpg new file mode 100644 index 0000000..0be0ed9 Binary files /dev/null and b/public/uploads/event/6.jpg differ diff --git a/public/uploads/event/7.jpg b/public/uploads/event/7.jpg new file mode 100644 index 0000000..98bbf36 Binary files /dev/null and b/public/uploads/event/7.jpg differ diff --git a/public/uploads/event/8.jpg b/public/uploads/event/8.jpg new file mode 100644 index 0000000..9788a7f Binary files /dev/null and b/public/uploads/event/8.jpg differ diff --git a/public/uploads/event/9.jpg b/public/uploads/event/9.jpg new file mode 100644 index 0000000..ef9e49e Binary files /dev/null and b/public/uploads/event/9.jpg differ diff --git a/public/uploads/event/dots.png b/public/uploads/event/dots.png new file mode 100644 index 0000000..4571a18 Binary files /dev/null and b/public/uploads/event/dots.png differ diff --git a/public/uploads/event/image01.png b/public/uploads/event/image01.png new file mode 100644 index 0000000..6f91cba Binary files /dev/null and b/public/uploads/event/image01.png differ diff --git a/public/uploads/event/image02.png b/public/uploads/event/image02.png new file mode 100644 index 0000000..018c696 Binary files /dev/null and b/public/uploads/event/image02.png differ diff --git a/public/uploads/event/info.jpg b/public/uploads/event/info.jpg new file mode 100644 index 0000000..37e1335 Binary files /dev/null and b/public/uploads/event/info.jpg differ diff --git a/public/uploads/event/round.png b/public/uploads/event/round.png new file mode 100644 index 0000000..9ec86ca Binary files /dev/null and b/public/uploads/event/round.png differ diff --git a/public/uploads/event/speaker01.png b/public/uploads/event/speaker01.png new file mode 100644 index 0000000..a08d28a Binary files /dev/null and b/public/uploads/event/speaker01.png differ diff --git a/public/uploads/event/speaker02.png b/public/uploads/event/speaker02.png new file mode 100644 index 0000000..4936423 Binary files /dev/null and b/public/uploads/event/speaker02.png differ diff --git a/public/uploads/event/speaker03.png b/public/uploads/event/speaker03.png new file mode 100644 index 0000000..52e080f Binary files /dev/null and b/public/uploads/event/speaker03.png differ diff --git a/public/uploads/event/speaker04.png b/public/uploads/event/speaker04.png new file mode 100644 index 0000000..93e858d Binary files /dev/null and b/public/uploads/event/speaker04.png differ diff --git a/public/uploads/event/speaker05.png b/public/uploads/event/speaker05.png new file mode 100644 index 0000000..3f16e21 Binary files /dev/null and b/public/uploads/event/speaker05.png differ diff --git a/public/uploads/event/speaker06.png b/public/uploads/event/speaker06.png new file mode 100644 index 0000000..03738aa Binary files /dev/null and b/public/uploads/event/speaker06.png differ