diff options
author | Mateja <mail@matejamaric.com> | 2020-11-06 19:59:52 +0100 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-11-06 19:59:52 +0100 |
commit | 7907c1eecc37e5378da0e28838203c70c693ec71 (patch) | |
tree | 9857f84448852867b3cd85aece534478fb05d09e | |
parent | 34b559e17e7896ca5b19221187f77c063b68d8eb (diff) | |
download | yota-laravel-7907c1eecc37e5378da0e28838203c70c693ec71.tar.gz yota-laravel-7907c1eecc37e5378da0e28838203c70c693ec71.zip |
Gallery work...
-rw-r--r-- | app/Http/Controllers/GalleryController.php | 2 | ||||
-rw-r--r-- | app/Models/Image.php | 11 | ||||
-rw-r--r-- | database/migrations/2020_11_06_185340_create_images_table.php | 33 | ||||
-rw-r--r-- | resources/views/inc/navbar.blade.php | 6 | ||||
-rw-r--r-- | resources/views/inc/special_navbar.blade.php | 4 | ||||
-rw-r--r-- | resources/views/pages/gallery-add.blade.php | 13 | ||||
-rw-r--r-- | routes/web.php | 3 |
7 files changed, 66 insertions, 6 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php index efbb55f..8f42b48 100644 --- a/app/Http/Controllers/GalleryController.php +++ b/app/Http/Controllers/GalleryController.php @@ -23,7 +23,7 @@ class GalleryController extends Controller */ public function create() { - // + return view('pages.gallery-add'); } /** diff --git a/app/Models/Image.php b/app/Models/Image.php new file mode 100644 index 0000000..643259e --- /dev/null +++ b/app/Models/Image.php @@ -0,0 +1,11 @@ +<?php + +namespace App\Models; + +use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; + +class Image extends Model +{ + use HasFactory; +} diff --git a/database/migrations/2020_11_06_185340_create_images_table.php b/database/migrations/2020_11_06_185340_create_images_table.php new file mode 100644 index 0000000..5c03545 --- /dev/null +++ b/database/migrations/2020_11_06_185340_create_images_table.php @@ -0,0 +1,33 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateImagesTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('images', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->string('path'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('images'); + } +} diff --git a/resources/views/inc/navbar.blade.php b/resources/views/inc/navbar.blade.php index 60bda7b..332c799 100644 --- a/resources/views/inc/navbar.blade.php +++ b/resources/views/inc/navbar.blade.php @@ -16,12 +16,12 @@ <div class="navbar-nav ml-auto"> @if (Auth::check()) <div class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Administration - </a> + </span> <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" href="{{ route('newsAdd') }}">News</a> - <a class="dropdown-item" href="#">Gallery</a> + <a class="dropdown-item" href="{{ route('galleryAdd') }}">Gallery</a> </div> </div> <a href="{{ route('logout') }}" class="nav-item nav-link">Logout</a> diff --git a/resources/views/inc/special_navbar.blade.php b/resources/views/inc/special_navbar.blade.php index 763a470..69ec1e8 100644 --- a/resources/views/inc/special_navbar.blade.php +++ b/resources/views/inc/special_navbar.blade.php @@ -13,9 +13,9 @@ <div class="navbar-nav ml-auto"> @if (Auth::check()) <div class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Administration - </a> + </span> <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" href="{{ route('addSign') }}">Callsigns</a> <a class="dropdown-item" href="{{ route('reservations') }}">Reservations</a> diff --git a/resources/views/pages/gallery-add.blade.php b/resources/views/pages/gallery-add.blade.php new file mode 100644 index 0000000..2d0ec27 --- /dev/null +++ b/resources/views/pages/gallery-add.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.app') + +@section('title', 'Add image') + +@section('content') + <form action="{{ route('galleryAddForm')}}" method="POST" enctype="multipart/form-data"> + @csrf + <div class="form-group"> + <input type="file" placeholder="Choose images" name="images"/> + </div> + <input type="submit" value="Submit" name="submit" class="btn btn-primary"/> + </form> +@endsection() diff --git a/routes/web.php b/routes/web.php index 7797a17..02b5107 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,6 +32,9 @@ Route::get('/news/delete/{id}', [NewsController::class, 'destroy'])->name('newsD Route::get('/gallery', [GalleryController::class, 'index'])->name('gallery'); +Route::get('/gallery/add', [GalleryController::class, 'create'])->name('galleryAdd')->middleware(['auth']); +Route::post('/gallery/add', [GalleryController::class, 'create'])->name('galleryAddForm')->middleware(['auth']); +Route::get('/gallery/delete/{id}', [GalleryController::class, 'destroy'])->name('galleryDelete')->middleware(['auth']); Route::get('/special-calls', [ReservationsController::class, 'index'])->name('activities'); |