From 1eaa34516b3148d9efa872cf3693df76464c3997 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 29 Jun 2020 09:21:17 +0200 Subject: [PATCH 1/7] Fixed PhoneController.php --- .../app/Http/Controllers/PhoneController.php | 13 +++++++++++++ .../resources/views/app/layout/base.blade.php | 15 ++++++++++----- skolehjem/routes/web.php | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 skolehjem/app/Http/Controllers/PhoneController.php diff --git a/skolehjem/app/Http/Controllers/PhoneController.php b/skolehjem/app/Http/Controllers/PhoneController.php new file mode 100644 index 0000000..e2c3466 --- /dev/null +++ b/skolehjem/app/Http/Controllers/PhoneController.php @@ -0,0 +1,13 @@ + +
+

Eksterne Links

+
+ ReadVis Links +
+ +
From b5ede965fe44a74d8c93c90d11989526aa0fe838 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 29 Jun 2020 14:28:09 +0200 Subject: [PATCH 3/7] Began working on security. --- .../Controllers/ExternalLinkController.php | 9 ++++++ .../app/Http/Controllers/UserController.php | 31 ++++++++++--------- skolehjem/app/Http/Kernel.php | 2 ++ skolehjem/app/Http/Middleware/CheckAuth.php | 31 +++++++++++++++++++ skolehjem/database/seeds/DatabaseSeeder.php | 1 + skolehjem/database/seeds/PermissionSeeder.php | 4 +-- skolehjem/database/seeds/UserSeeder.php | 28 +++++++++++++++++ 7 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 skolehjem/app/Http/Middleware/CheckAuth.php create mode 100644 skolehjem/database/seeds/UserSeeder.php diff --git a/skolehjem/app/Http/Controllers/ExternalLinkController.php b/skolehjem/app/Http/Controllers/ExternalLinkController.php index 2a6eafa..8f99398 100644 --- a/skolehjem/app/Http/Controllers/ExternalLinkController.php +++ b/skolehjem/app/Http/Controllers/ExternalLinkController.php @@ -9,6 +9,15 @@ use Illuminate\Http\Response; class ExternalLinkController extends Controller { + function __construct() + { + $this->middleware("permission:link.external.list")->only("index"); + $this->middleware("permission:link.external.create")->only(["create", "store"]); + $this->middleware("permission:link.external.show")->only("show"); + $this->middleware("permission:link.external.edit")->only(["edit", "update"]); + $this->middleware("permission:link.external.delete")->only("destroy"); + } + /** * Display a listing of the resource. * diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index 5880e1d..ac5c34d 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -14,13 +14,14 @@ class UserController extends Controller { public function __construct() { -// $this->middleware([ "auth" ])->only("logout"); -// $this->middleware([ "guest" ])->only("login"); -// -// $this->middleware([ "permission:user.list", "role:admin" ])->only("index"); -// $this->middleware([ "permission:user.show", "role:admin" ])->only("show"); -// $this->middleware([ "permission:user.edit", "role:admin" ])->only([ "edit", "update" ]); -// $this->middleware([ "permission:user.delete", "role:admin" ])->only("delete"); + $this->middleware([ "auth" ])->only("logout"); + $this->middleware([ "guest" ])->only("login"); + + $this->middleware([ "check.auth:user.list" ])->only("index"); + $this->middleware([ "check.auth:user.show" ])->only("show"); + $this->middleware([ "check.auth:user.create" ])->only("create"); + $this->middleware([ "check.auth:user.edit" ])->only("edit", "update"); + $this->middleware([ "check.auth:user.delete" ])->only("delete"); } /** @@ -54,7 +55,7 @@ class UserController extends Controller */ public function store(Request $request) { - Log::debug("STORE FUNCTION"); +// Log::debug("STORE FUNCTION"); $data = $request->validate([ "name_first" => "required|max:255", @@ -65,17 +66,17 @@ class UserController extends Controller ]); - Log::debug("FINISHED VALIDATION?"); +// Log::debug("FINISHED VALIDATION?"); $user = new User($data); - Log::debug("CREATED USER [NOT PERSISTED YET]"); +// Log::debug("CREATED USER [NOT PERSISTED YET]"); $user->save(); - Log::debug("SAVED USER"); +// Log::debug("SAVED USER"); - return view("users.store"); + return Response::detect("users.store"); } /** @@ -182,7 +183,7 @@ class UserController extends Controller /*******************************************/ public function showLogin() { - return view("admin.users.login"); + return Response::detect("users.login"); } public function login(Request $request) { @@ -190,7 +191,7 @@ class UserController extends Controller if(Auth::attempt($data)) { //TODO: Implement home? - return redirect()->route("users.index"); + return redirect()->route("root.index"); } return redirect()->back(303); @@ -199,6 +200,6 @@ class UserController extends Controller public function logout(Request $request) { Auth::logout(); - return redirect()->to("/"); + return redirect()->route("root.index"); } } diff --git a/skolehjem/app/Http/Kernel.php b/skolehjem/app/Http/Kernel.php index 6a08dd6..3e1e21b 100644 --- a/skolehjem/app/Http/Kernel.php +++ b/skolehjem/app/Http/Kernel.php @@ -67,5 +67,7 @@ class Kernel extends HttpKernel 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, + + "check.auth" => \App\Http\Middleware\CheckAuth::class ]; } diff --git a/skolehjem/app/Http/Middleware/CheckAuth.php b/skolehjem/app/Http/Middleware/CheckAuth.php new file mode 100644 index 0000000..2c5df81 --- /dev/null +++ b/skolehjem/app/Http/Middleware/CheckAuth.php @@ -0,0 +1,31 @@ +user(); + + if(!isset($user)) + return redirect()->route("users.login"); + + if($user->hasAnyPermission($permissions)) { + return $next($request); + } + + return redirect()->route("users.login"); + } +} diff --git a/skolehjem/database/seeds/DatabaseSeeder.php b/skolehjem/database/seeds/DatabaseSeeder.php index 64479c8..624abbb 100644 --- a/skolehjem/database/seeds/DatabaseSeeder.php +++ b/skolehjem/database/seeds/DatabaseSeeder.php @@ -12,5 +12,6 @@ class DatabaseSeeder extends Seeder public function run() { $this->call(PermissionSeeder::class); + $this->call(UserSeeder::class); } } diff --git a/skolehjem/database/seeds/PermissionSeeder.php b/skolehjem/database/seeds/PermissionSeeder.php index bbd8c28..b2cd3f5 100644 --- a/skolehjem/database/seeds/PermissionSeeder.php +++ b/skolehjem/database/seeds/PermissionSeeder.php @@ -44,8 +44,8 @@ class PermissionSeeder extends Seeder ]; foreach ($permissions as $key => $value) { - if(Permission::findByName($key)) - continue; +// if(Permission::findByName($key)) +// continue; $permission = new Permission(); diff --git a/skolehjem/database/seeds/UserSeeder.php b/skolehjem/database/seeds/UserSeeder.php new file mode 100644 index 0000000..0c11ea0 --- /dev/null +++ b/skolehjem/database/seeds/UserSeeder.php @@ -0,0 +1,28 @@ +name_first = "admin"; + $user->name_last = "admin"; + $user->email = "admin@admin.local"; + $user->setPasswordAttribute("1234"); + $user->phone = 12345678; + + foreach (\Spatie\Permission\Models\Permission::all() as $permission) { + $user->givePermissionTo($permission); + } + + $user->save(); + } +} From 988ceb7c8a3f191ae4205322258e030b9488fbf2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 29 Jun 2020 14:49:57 +0200 Subject: [PATCH 4/7] Fixed error AND 0x01 --- skolehjem/app/MenuPlan.php | 2 +- .../2014_10_12_000000_create_users_table.php | 3 ++ ..._06_08_080402_create_permission_tables.php | 18 +++++---- .../2020_06_23_070657_create_menu_plans.php | 6 +-- .../2020_06_29_112658_create_staff_table.php | 38 ------------------- .../views/admin/layout/base.blade.php | 18 ++++----- .../views/admin/users/index.blade.php | 9 ++++- skolehjem/routes/web.php | 2 +- 8 files changed, 36 insertions(+), 60 deletions(-) delete mode 100644 skolehjem/database/migrations/2020_06_29_112658_create_staff_table.php diff --git a/skolehjem/app/MenuPlan.php b/skolehjem/app/MenuPlan.php index cce1492..c8131e1 100644 --- a/skolehjem/app/MenuPlan.php +++ b/skolehjem/app/MenuPlan.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class MenuPlan extends Model { protected $fillable = [ - 'monday', "tuesday", 'wednesday', 'thursday', "friday", "saturday", "sunday" + 'monday', "tuesday", 'wednesday', 'thursday' ]; } diff --git a/skolehjem/database/migrations/2014_10_12_000000_create_users_table.php b/skolehjem/database/migrations/2014_10_12_000000_create_users_table.php index 04e336e..9760e02 100644 --- a/skolehjem/database/migrations/2014_10_12_000000_create_users_table.php +++ b/skolehjem/database/migrations/2014_10_12_000000_create_users_table.php @@ -13,6 +13,9 @@ class CreateUsersTable extends Migration */ public function up() { + if(Schema::hasTable("users")) + return; + Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name_first'); diff --git a/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php b/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php index 81d91b2..8e7ae7b 100644 --- a/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php +++ b/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php @@ -20,13 +20,17 @@ class CreatePermissionTables extends Migration throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); } - Schema::create($tableNames['permissions'], function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('name'); - $table->string('description'); - $table->string('guard_name'); - $table->timestamps(); - }); + if(!Schema::hasTable("permissions")) + { + Schema::create($tableNames['permissions'], function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('name'); + $table->string('description'); + $table->string('guard_name'); + $table->timestamps(); + }); + } + Schema::create($tableNames['roles'], function (Blueprint $table) { $table->bigIncrements('id'); diff --git a/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php b/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php index 9506908..d3a43d4 100644 --- a/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php +++ b/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php @@ -19,9 +19,9 @@ class CreateMenuPlans extends Migration $table->string('tuesday', 255); $table->string('wednesday', 255); $table->string('thursday', 255); - $table->string('friday', 255); - $table->string('saturday', 255); - $table->string('sunday', 255); +// $table->string('friday', 255); +// $table->string('saturday', 255); +// $table->string('sunday', 255); $table->timestamps(); //$table->text('description'); }); diff --git a/skolehjem/database/migrations/2020_06_29_112658_create_staff_table.php b/skolehjem/database/migrations/2020_06_29_112658_create_staff_table.php deleted file mode 100644 index 0ad0194..0000000 --- a/skolehjem/database/migrations/2020_06_29_112658_create_staff_table.php +++ /dev/null @@ -1,38 +0,0 @@ -id(); - $table->string('name_first'); - $table->string('name_last'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->integer("phone")->unique(); - $table->rememberToken(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('staff'); - } -} diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 9732280..5ef177c 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -61,15 +61,15 @@ CreateOpret Kontakt
-
-

Personale

- - -
+{{--
--}} +{{--

Personale

--}} +{{--
--}} +{{-- ReadVis Personale--}} +{{--
--}} +{{--
--}} +{{-- CreateOpret Personal--}} +{{--
--}} +{{--
--}}

Feedback

diff --git a/skolehjem/resources/views/admin/users/index.blade.php b/skolehjem/resources/views/admin/users/index.blade.php index a6e15d1..3b2713b 100644 --- a/skolehjem/resources/views/admin/users/index.blade.php +++ b/skolehjem/resources/views/admin/users/index.blade.php @@ -26,7 +26,14 @@ {{ $user->email }} {{ $user->phone }} $user->id ]) }}">Update - $user ]) }}">Delete + + $user ]) }}" class="w-100"> + @csrf + @method("delete") + + + + @endforeach diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index 4c9643f..97c63aa 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -31,7 +31,7 @@ Route::get("phones", "PhoneController@index")->name("phones.index"); Route::resource("contacts", "ContactController"); Route::resource("menu-plans", "MenuPlanController"); Route::resource("users", "UserController"); -Route::resource("staff", "StaffController"); +//Route::resource("staff", "StaffController"); Route::resource("events", "EventController"); Route::resource("washing-machines", "WashingMachineController"); Route::resource("washing-reservations", "WashingReservationController"); From 4a0840b104eef4d7542046e2e20c2839e45d4400 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 30 Jun 2020 08:24:29 +0200 Subject: [PATCH 5/7] Modified base.blade.php? --- PERMS.ods | Bin 4197 -> 4360 bytes .../views/admin/layout/base.blade.php | 3 --- 2 files changed, 3 deletions(-) diff --git a/PERMS.ods b/PERMS.ods index ebc91fe223d372645be8d3e89a9c770be6070bbf..735d1c364fd1090bab2b5a89dc4787a4bb97b78a 100644 GIT binary patch delta 3772 zcmV;t4ny(fAc!K6Vt-^ZA2jg=001u{000UA0047zd2D5KE_iKh)LP$f+cpq>AF%&H zP_Vtpmh7alJJ_`LxPA|g-Q&=*^Je=a?i{<$}_#R88B1#ecT$- zd0ygs+4pIs+g)34qwm97x%+g^(WdXiN*7S>K3=fC58n$K6)ehFStCgR?Cv!8lvKBA zxR$b>4Tqb}W`D354;Wt!lj(Fi)Y8y8D$l%L-EgY4@@$AHR!$YeWRMJ0Hid=xHR1Q!gVw?G+=a-31Im>aA8FoZuu zwvOO5{F49#fH$y$Dd1e|rMJ}0oNl*z*{ubB%`%7pb@Y2!pOiGl4OWRh>{gh4{9VU0og1J z3N~A!?0NUK3 zy8CYXyL)|~LrZK{5K4V^_9LzhaB_NjKFUtRKucJSG9sbtlEm>(c1%dlZdLZS`5hWG zW+>W_T&~kF9>mFbG9?wnW-D}njem->(WKZCJ-Wf%U;2=o(5BC)y?YG+ik4ApR} z*T^oXZh_Qxgfyu^=f^gJd_Tm1>HAVOTHy#<0IZQV)tD?(mx+hAqtk^KShYla1^pq( zz^qsy(2gycgbvJ;VTucAd_2&8gckip#!R-y#-jqt2VUD^o%Y(?N|XuM}i};oA0u;=y=2K9A$`$@yuV zoSmO-!}>-1c6*@B6uWG*Mt>dHULQrRvD=2(G|>siHr$`aw+;Lf+Q!ZoKI-kDnrSQQ z%i1@;I;+_BSocU66c=;d@2~B*SYs@;^5Wv+Vm{Qu&Y&Fub-NQciwQmJ8RcPXlzov+ z!vayE-yDplfyJ->7i_~=A^r9-F2zm z|I~0C^gjTTkqi`n%wT96qy_*0yix!F3jhEBV{dMBWo~pXcx`O#T+NcBHW0q2D(^sX z$PGN6e>-FEAzL}6_OjUrkcF_R5r{})7{7g55@3PtUE}fZz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0BU zUGD`9_oIT_*SsFmg~q~rwowBgZt&zw-nk>N)ga2HD1V}uXiu%I95L!&4exG-_(c=< zOgcQCbMS*k;i(urBh$WN@0`c;gYLwh|Kz{3f@iPn7hR_R0ssL2{{sL}O9KRxe-Ijz zSPlCGT%TOklUEKRe`B`^jg_Pa1UCdy3kPn--j)c*u40F@e^1^@d*ZmeGqba!O}FP# zdB0HE!srZIWq diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 5ef177c..616e97a 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -57,9 +57,6 @@ -
{{--
--}} {{--

Personale

--}} From c609cf78ff54a9c8e0bb05abe9fa253e8aef95e1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 30 Jun 2020 08:49:39 +0200 Subject: [PATCH 6/7] Added more permissions to the seeder. --- skolehjem/database/seeds/PermissionSeeder.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/skolehjem/database/seeds/PermissionSeeder.php b/skolehjem/database/seeds/PermissionSeeder.php index b2cd3f5..8e2a639 100644 --- a/skolehjem/database/seeds/PermissionSeeder.php +++ b/skolehjem/database/seeds/PermissionSeeder.php @@ -40,19 +40,29 @@ class PermissionSeeder extends Seeder "link.external.edit" => "Allows editing of external links.", "link.external.delete" => "Allows deletion of external links", + "event.create" => "Create a new event", + "event.list" => "Shows all events", + "event.show" => "Shows event", + "event.edit" => "Edit event", + "event.delete" => "Deletes an event", + "contact.create" => "Creates a new contact", + "contact.list" => "" ]; foreach ($permissions as $key => $value) { -// if(Permission::findByName($key)) -// continue; - $permission = new Permission(); + try { + if(Permission::findByName($key)) + continue; + } catch (Exception $e) { + $permission = new Permission(); - $permission->name = $key; - $permission->description = $value; + $permission->name = $key; + $permission->description = $value; - $permission->save(); + $permission->save(); + } } } } From 8445a227325a2c26be786ae73554a6fe6b4566e5 Mon Sep 17 00:00:00 2001 From: frederikpyt Date: Tue, 30 Jun 2020 08:52:46 +0200 Subject: [PATCH 7/7] 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'); } }