From 20bfcb2c97f147f4050fce2e61c8c7c9f361db06 Mon Sep 17 00:00:00 2001 From: Neerholt Date: Tue, 30 Jun 2020 08:50:04 +0200 Subject: [PATCH 1/3] Made gallery, video, album, migrations --- ...2020_06_30_064605_create_gallery_album.php | 31 +++++++++++++++++++ ...2020_06_30_064640_create_gallery_video.php | 31 +++++++++++++++++++ ...2020_06_30_064737_create_gallery_image.php | 31 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php create mode 100644 skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php create mode 100644 skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php diff --git a/skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php b/skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php new file mode 100644 index 0000000..64ef7bb --- /dev/null +++ b/skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('gallery_album'); + } +} diff --git a/skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php b/skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php new file mode 100644 index 0000000..47e1419 --- /dev/null +++ b/skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('gallery_video'); + } +} diff --git a/skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php b/skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php new file mode 100644 index 0000000..ad0d012 --- /dev/null +++ b/skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('gallery_image'); + } +} From 66e8b2e3d819ffc6a0ec83f6421ede4d1dfc7330 Mon Sep 17 00:00:00 2001 From: Vedde Date: Tue, 30 Jun 2020 08:52:11 +0200 Subject: [PATCH 2/3] Modified EventController.php. --- .../app/Http/Controllers/EventController.php | 19 +++++++++---------- .../views/admin/events/edit.blade.php | 13 ++++++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/skolehjem/app/Http/Controllers/EventController.php b/skolehjem/app/Http/Controllers/EventController.php index e5754f5..0dc11e7 100644 --- a/skolehjem/app/Http/Controllers/EventController.php +++ b/skolehjem/app/Http/Controllers/EventController.php @@ -70,9 +70,10 @@ class EventController extends Controller * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function edit(Event $id) + public function edit($id) { - return Response::detect("events.edit", [ "event" => $id ]); + $event = Event::find($id); + return Response::detect("events.edit", [ "event" => $event ]); } /** @@ -82,17 +83,15 @@ class EventController extends Controller * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function update(Request $request, Event $id) + public function update(Request $request, $id) { - $requestBody = $request->validate([ - "name" => "unique:events|max:255", - "description" => "max:255" - ]); + $data = $request->all(); - $id->update($requestBody); - $id->save(); + $event = Event::find($id); + $event->update($data); + $event->save(); - return Response::detect("events.update"); + return Response::detect("events.update", [ "event" => $event]); } /** diff --git a/skolehjem/resources/views/admin/events/edit.blade.php b/skolehjem/resources/views/admin/events/edit.blade.php index 91118bc..8356c41 100644 --- a/skolehjem/resources/views/admin/events/edit.blade.php +++ b/skolehjem/resources/views/admin/events/edit.blade.php @@ -6,7 +6,7 @@ @endsection @section("path") - Vis Events / + $event])}}" class="text-white">Vis Events / @endsection @section("content") @@ -14,10 +14,13 @@
$event])}}"> @csrf @method("PUT") - - - - + + + + + + +
@endsection From 8445a227325a2c26be786ae73554a6fe6b4566e5 Mon Sep 17 00:00:00 2001 From: frederikpyt Date: Tue, 30 Jun 2020 08:52:46 +0200 Subject: [PATCH 3/3] Created files for gallery --- .../app/Http/Controllers/AlbumController.php | 77 ++++++++++++++++++- .../app/Http/Controllers/ImageController.php | 77 ++++++++++++++++++- .../app/Http/Controllers/VideoController.php | 77 ++++++++++++++++++- ...2020_06_30_065154_create_albums_table.php} | 6 +- ...2020_06_30_065200_create_images_table.php} | 6 +- ...2020_06_30_065206_create_videos_table.php} | 6 +- 6 files changed, 237 insertions(+), 12 deletions(-) rename skolehjem/database/migrations/{2020_06_30_064605_create_gallery_album.php => 2020_06_30_065154_create_albums_table.php} (72%) rename skolehjem/database/migrations/{2020_06_30_064640_create_gallery_video.php => 2020_06_30_065200_create_images_table.php} (72%) rename skolehjem/database/migrations/{2020_06_30_064737_create_gallery_image.php => 2020_06_30_065206_create_videos_table.php} (72%) diff --git a/skolehjem/app/Http/Controllers/AlbumController.php b/skolehjem/app/Http/Controllers/AlbumController.php index 840daf7..191d47b 100644 --- a/skolehjem/app/Http/Controllers/AlbumController.php +++ b/skolehjem/app/Http/Controllers/AlbumController.php @@ -2,9 +2,84 @@ namespace App\Http\Controllers; +use App\Album; use Illuminate\Http\Request; class AlbumController extends Controller { - // + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + // + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param \App\Album $album + * @return \Illuminate\Http\Response + */ + public function show(Album $album) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Album $album + * @return \Illuminate\Http\Response + */ + public function edit(Album $album) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Album $album + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Album $album) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Album $album + * @return \Illuminate\Http\Response + */ + public function destroy(Album $album) + { + // + } } diff --git a/skolehjem/app/Http/Controllers/ImageController.php b/skolehjem/app/Http/Controllers/ImageController.php index 820ed55..4aeb7c8 100644 --- a/skolehjem/app/Http/Controllers/ImageController.php +++ b/skolehjem/app/Http/Controllers/ImageController.php @@ -2,9 +2,84 @@ namespace App\Http\Controllers; +use App\Image; use Illuminate\Http\Request; class ImageController extends Controller { - // + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + // + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param \App\Image $image + * @return \Illuminate\Http\Response + */ + public function show(Image $image) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Image $image + * @return \Illuminate\Http\Response + */ + public function edit(Image $image) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Image $image + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Image $image) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Image $image + * @return \Illuminate\Http\Response + */ + public function destroy(Image $image) + { + // + } } diff --git a/skolehjem/app/Http/Controllers/VideoController.php b/skolehjem/app/Http/Controllers/VideoController.php index b760852..486395e 100644 --- a/skolehjem/app/Http/Controllers/VideoController.php +++ b/skolehjem/app/Http/Controllers/VideoController.php @@ -2,9 +2,84 @@ namespace App\Http\Controllers; +use App\Video; use Illuminate\Http\Request; class VideoController extends Controller { - // + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + // + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param \App\Video $video + * @return \Illuminate\Http\Response + */ + public function show(Video $video) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Video $video + * @return \Illuminate\Http\Response + */ + public function edit(Video $video) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Video $video + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Video $video) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Video $video + * @return \Illuminate\Http\Response + */ + public function destroy(Video $video) + { + // + } } diff --git a/skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php b/skolehjem/database/migrations/2020_06_30_065154_create_albums_table.php similarity index 72% rename from skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php rename to skolehjem/database/migrations/2020_06_30_065154_create_albums_table.php index 64ef7bb..5efab97 100644 --- a/skolehjem/database/migrations/2020_06_30_064605_create_gallery_album.php +++ b/skolehjem/database/migrations/2020_06_30_065154_create_albums_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateGalleryAlbum extends Migration +class CreateAlbumsTable extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateGalleryAlbum extends Migration */ public function up() { - Schema::create('gallery_album', function (Blueprint $table) { + Schema::create('albums', function (Blueprint $table) { $table->id(); $table->timestamps(); }); @@ -26,6 +26,6 @@ class CreateGalleryAlbum extends Migration */ public function down() { - Schema::dropIfExists('gallery_album'); + Schema::dropIfExists('albums'); } } diff --git a/skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php b/skolehjem/database/migrations/2020_06_30_065200_create_images_table.php similarity index 72% rename from skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php rename to skolehjem/database/migrations/2020_06_30_065200_create_images_table.php index 47e1419..0ec15bd 100644 --- a/skolehjem/database/migrations/2020_06_30_064640_create_gallery_video.php +++ b/skolehjem/database/migrations/2020_06_30_065200_create_images_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateGalleryVideo extends Migration +class CreateImagesTable extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateGalleryVideo extends Migration */ public function up() { - Schema::create('gallery_video', function (Blueprint $table) { + Schema::create('images', function (Blueprint $table) { $table->id(); $table->timestamps(); }); @@ -26,6 +26,6 @@ class CreateGalleryVideo extends Migration */ public function down() { - Schema::dropIfExists('gallery_video'); + Schema::dropIfExists('images'); } } diff --git a/skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php b/skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php similarity index 72% rename from skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php rename to skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php index ad0d012..fa4dc4d 100644 --- a/skolehjem/database/migrations/2020_06_30_064737_create_gallery_image.php +++ b/skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateGalleryImage extends Migration +class CreateVideosTable extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateGalleryImage extends Migration */ public function up() { - Schema::create('gallery_image', function (Blueprint $table) { + Schema::create('videos', function (Blueprint $table) { $table->id(); $table->timestamps(); }); @@ -26,6 +26,6 @@ class CreateGalleryImage extends Migration */ public function down() { - Schema::dropIfExists('gallery_image'); + Schema::dropIfExists('videos'); } }