Browse Source

adding

master
Björn 3 years ago
parent
commit
04f9705172
19 changed files with 228 additions and 69 deletions
  1. +0
    -14
      .env0
  2. +4
    -1
      app/Http/Controllers/BucketController.php
  3. +7
    -1
      app/Http/Controllers/HomeController.php
  4. +1
    -1
      app/Models/Bucket.php
  5. +3
    -1
      composer.json
  6. +111
    -1
      composer.lock
  7. +4
    -4
      database/migrations/2020_11_20_120236_create_roles_table.php
  8. +2
    -2
      database/migrations/2020_11_22_000000_create_links_table.php
  9. +5
    -5
      database/migrations/2020_12_20_114514_create_bucket_users_table.php
  10. +2
    -2
      public/css/bootstrap.css
  11. +1
    -1
      public/js/bucket.js
  12. +1
    -1
      public/js/home.js
  13. +46
    -0
      public/logo.svg
  14. +2
    -2
      resources/js/components/buckets.riot
  15. +14
    -0
      resources/scss/bootstrap.scss
  16. +1
    -1
      resources/views/bucket/create.blade.php
  17. +1
    -17
      resources/views/home.blade.php
  18. +22
    -14
      resources/views/layout.blade.php
  19. +1
    -1
      routes/web.php

+ 0
- 14
.env0 View File

@ -1,14 +0,0 @@
APP_NAME=Urban-Filehub
APP_ENV=development
APP_VERSION=1.0.0
APP_KEY=base64:W2hi43X7fQQOdlMZuD/g2zvcdOde79IJ68pEl4CTxGY=
APP_DEBUG=true
APP_URL=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db876529637523745
DB_USERNAME=u595949632775429
DB_PASSWORD=test
DB_PREFIX=

+ 4
- 1
app/Http/Controllers/BucketController.php View File

@ -7,6 +7,8 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use App\Models\Bucket;
class BucketController extends BaseController class BucketController extends BaseController
{ {
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
@ -48,10 +50,11 @@ class BucketController extends BaseController
if ($validated) { if ($validated) {
// create bucket
$bucket = Bucket::create($validated); $bucket = Bucket::create($validated);
return redirect() return redirect()
->route('bucket.single', ['uuid' => 12]);
->route('bucket.single', [ 'id' => $bucket->id ]);
} else { } else {
return back() return back()
->withInput(); ->withInput();


+ 7
- 1
app/Http/Controllers/HomeController.php View File

@ -7,6 +7,8 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use App\Models\Bucket;
class HomeController extends BaseController class HomeController extends BaseController
{ {
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
@ -18,6 +20,10 @@ class HomeController extends BaseController
*/ */
public function show() public function show()
{ {
return view('home');
$buckets = Bucket::get();
return view('home', [
'buckets' => $buckets
]);
} }
} }

+ 1
- 1
app/Models/Bucket.php View File

@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Model;
class Bucket extends Model class Bucket extends Model
{ {


+ 3
- 1
composer.json View File

@ -11,9 +11,11 @@
"php": "^7.3|^8.0", "php": "^7.3|^8.0",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
"goldspecdigital/laravel-eloquent-uuid": "^8.0",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12", "laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
"laravel/tinker": "^2.5",
"webpatser/laravel-uuid": "^3.0"
}, },
"require-dev": { "require-dev": {
"facade/ignition": "^2.5", "facade/ignition": "^2.5",


+ 111
- 1
composer.lock View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "fac753ae2702317b354e7eb283f28cbc",
"content-hash": "5fab0a30e94ae154f941445595e22672",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@ -555,6 +555,62 @@
], ],
"time": "2020-10-22T13:57:20+00:00" "time": "2020-10-22T13:57:20+00:00"
}, },
{
"name": "goldspecdigital/laravel-eloquent-uuid",
"version": "v8.0.1",
"source": {
"type": "git",
"url": "https://github.com/goldspecdigital/laravel-eloquent-uuid.git",
"reference": "e98748113e3b9de5b408cdc306e9d93e18121988"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/goldspecdigital/laravel-eloquent-uuid/zipball/e98748113e3b9de5b408cdc306e9d93e18121988",
"reference": "e98748113e3b9de5b408cdc306e9d93e18121988",
"shasum": ""
},
"require": {
"laravel/framework": "^8.0",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"ext-pdo": "*",
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^8.4"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"GoldSpecDigital\\LaravelEloquentUUID\\UuidServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"GoldSpecDigital\\LaravelEloquentUUID\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthew Inamdar",
"email": "matt@goldspecdigital.com"
}
],
"description": "A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.",
"homepage": "https://github.com/goldspecdigital/laravel-eloquent-uuid",
"keywords": [
"eloquent",
"laravel",
"php",
"uuid"
],
"time": "2020-12-23T10:10:54+00:00"
},
{ {
"name": "graham-campbell/result-type", "name": "graham-campbell/result-type",
"version": "v1.0.1", "version": "v1.0.1",
@ -4546,6 +4602,60 @@
} }
], ],
"time": "2020-11-12T00:07:28+00:00" "time": "2020-11-12T00:07:28+00:00"
},
{
"name": "webpatser/laravel-uuid",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/webpatser/laravel-uuid.git",
"reference": "a7ce65cdabbc9970fc2a87fdf67b48e0b1641d23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webpatser/laravel-uuid/zipball/a7ce65cdabbc9970fc2a87fdf67b48e0b1641d23",
"reference": "a7ce65cdabbc9970fc2a87fdf67b48e0b1641d23",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~6.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Webpatser\\Uuid\\UuidServiceProvider"
],
"aliases": {
"Uuid": "Webpatser\\Uuid\\Uuid"
}
}
},
"autoload": {
"psr-0": {
"Webpatser\\Uuid": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Kempen",
"email": "christoph@downsized.nl"
}
],
"description": "Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUIDs are built-in.",
"homepage": "https://github.com/webpatser/uuid",
"keywords": [
"UUID RFC4122"
],
"time": "2017-10-04T07:47:40+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [


+ 4
- 4
database/migrations/2020_11_20_120236_create_roles_table.php View File

@ -21,10 +21,10 @@ class CreateRolesTable extends Migration
$table->string('name'); $table->string('name');
// Foreign key for user // Foreign key for user
$table->uuid('hub_id');
$table->uuid('bucket_id');
$table->boolean('can_hub_delete')->default(false);
$table->boolean('can_hub_edit')->default(false);
$table->boolean('can_bucket_delete')->default(false);
$table->boolean('can_bucket_edit')->default(false);
$table->boolean('can_user_add')->default(false); $table->boolean('can_user_add')->default(false);
$table->boolean('can_user_remove')->default(false); $table->boolean('can_user_remove')->default(false);
@ -35,7 +35,7 @@ class CreateRolesTable extends Migration
$table->boolean('can_file_download')->default(false); $table->boolean('can_file_download')->default(false);
$table->boolean('can_file_edit')->default(false); $table->boolean('can_file_edit')->default(false);
$table->foreign('hub_id')->references('id')->on('hubs');
$table->foreign('bucket_id')->references('id')->on('buckets');
}); });
} }


+ 2
- 2
database/migrations/2020_11_22_000000_create_links_table.php View File

@ -19,10 +19,10 @@ class CreateLinksTable extends Migration
$table->string('hash'); $table->string('hash');
$table->uuid('user_id'); $table->uuid('user_id');
$table->uuid('hub_id');
$table->uuid('bucket_id');
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('hub_id')->references('id')->on('hubs');
$table->foreign('bucket_id')->references('id')->on('buckets');
$table->timestamps(); $table->timestamps();
}); });


database/migrations/2020_12_20_114514_create_hub_users_table.php → database/migrations/2020_12_20_114514_create_bucket_users_table.php View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
class CreateHubUsersTable extends Migration
class CreateBucketUsersTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
@ -13,13 +13,13 @@ class CreateHubUsersTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('hub_users', function (Blueprint $table)
Schema::create('bucket_users', function (Blueprint $table)
{ {
// Primary key. // Primary key.
$table->uuid('id')->primary(); $table->uuid('id')->primary();
// Foreign key for hub // Foreign key for hub
$table->uuid('hub_id');
$table->uuid('bucket_id');
// Foreign key for user // Foreign key for user
$table->uuid('user_id'); $table->uuid('user_id');
@ -27,7 +27,7 @@ class CreateHubUsersTable extends Migration
// Foreign key for user // Foreign key for user
$table->uuid('role_id'); $table->uuid('role_id');
$table->foreign('hub_id')->references('id')->on('hubs');
$table->foreign('bucket_id')->references('id')->on('buckets');
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('role_id')->references('id')->on('roles'); $table->foreign('role_id')->references('id')->on('roles');
}); });
@ -40,6 +40,6 @@ class CreateHubUsersTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::dropIfExists('hub_users');
Schema::dropIfExists('bucket_users');
} }
} }

+ 2
- 2
public/css/bootstrap.css
File diff suppressed because it is too large
View File


+ 1
- 1
public/js/bucket.js
File diff suppressed because it is too large
View File


+ 1
- 1
public/js/home.js
File diff suppressed because it is too large
View File


+ 46
- 0
public/logo.svg View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 290 290" style="enable-background:new 0 0 290 290;" xml:space="preserve">
<g>
<path d="M287.602,53.599l-51.2-51.2C234.862,0.863,232.777,0,230.602,0H8.199C3.668,0,0,3.668,0,8.199v273.602
C0,286.332,3.668,290,8.199,290h273.602c4.531,0,8.199-3.668,8.199-8.199V59.397C290,57.221,289.135,55.138,287.602,53.599z
M38.456,34.678c0-3.262,2.651-5.916,5.917-5.916h160.975c3.27,0,5.918,2.654,5.918,5.916v78.323c0,3.269-2.647,5.915-5.918,5.915
H44.373c-3.266,0-5.917-2.646-5.917-5.915V34.678z M251.544,247.513c0,4.03-3.27,7.298-7.296,7.298H45.752
c-4.026,0-7.296-3.268-7.296-7.298V150.94c0-4.028,3.27-7.295,7.296-7.295h198.496c4.026,0,7.296,3.267,7.296,7.295V247.513z"/>
<rect x="173.564" y="39.039" width="24.588" height="69.604"/>
<rect x="59.489" y="174.643" width="171.021" height="8.195"/>
<rect x="59.489" y="215.62" width="171.021" height="8.195"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

+ 2
- 2
resources/js/components/buckets.riot View File

@ -3,12 +3,12 @@
<div class="tile is-ancestor"> <div class="tile is-ancestor">
<div class="tile is-3 is-parent" each={ bucket in props.buckets }> <div class="tile is-3 is-parent" each={ bucket in props.buckets }>
<div class="tile is-child"> <div class="tile is-child">
<a class="buckets__item" href="/bucket/{ bucket.uuid }">
<a class="buckets__item" href="/bucket/{ bucket.id }">
<div class="content"> <div class="content">
<p class="title is-4"> <p class="title is-4">
{ bucket.name } { bucket.name }
</p> </p>
<div class="tags are-medium" if={ bucket.tags.length > 0 }>
<div class="tags are-medium" if={ bucket.tags && bucket.tags.length > 0 }>
<span class="tag is-white" each={ tag in bucket.tags }>{ tag }</span> <span class="tag is-white" each={ tag in bucket.tags }>{ tag }</span>
</div> </div>
</div> </div>


+ 14
- 0
resources/scss/bootstrap.scss View File

@ -15,6 +15,7 @@
@import "../../node_modules/bulma/sass/grid/_all.sass"; @import "../../node_modules/bulma/sass/grid/_all.sass";
@import "../../node_modules/bulma/sass/components/navbar.sass";
@import "../../node_modules/bulma/sass/components/card.sass"; @import "../../node_modules/bulma/sass/components/card.sass";
@import "../../node_modules/bulma/sass/components/tabs.sass"; @import "../../node_modules/bulma/sass/components/tabs.sass";
@ -68,5 +69,18 @@ label.required {
} }
} }
.app-header {
background: #eee;
border-bottom: 1px solid #d9d9d9;
}
.app-header__logo {
min-width: 30px;
}
.navbar {
background-color: transparent;
}
@include component__accordion(); @include component__accordion();
@include component__buckets(); @include component__buckets();

+ 1
- 1
resources/views/bucket/create.blade.php View File

@ -6,7 +6,7 @@
@section('main') @section('main')
<div class="container is-fluid"> <div class="container is-fluid">
<h1 class="title is-3 is-spaced">
<h1 class="title is-4 is-spaced mt-5">
Create Bucket Create Bucket
</h1> </h1>
<urban-bucket-form></urban-bucket-form> <urban-bucket-form></urban-bucket-form>


+ 1
- 17
resources/views/home.blade.php View File

@ -1,22 +1,6 @@
@extends('layout') @extends('layout')
@section('main') @section('main')
@php
$buckets = [ 'buckets' => [[
'uuid' => 'djdj333j',
'name' => 'llkjj lk',
'tags' => [
'test3', 'test2', 'test1'
]
],[
'uuid' => 'djdj333j',
'name' => 'flwhfjwh lkehjkh ',
'tags' => [
'test3', 'test2', 'test1'
]
]]];
@endphp
<div class="container is-fluid"> <div class="container is-fluid">
<h2 class="title is-4 is-spaced mt-6 mb-1"> <h2 class="title is-4 is-spaced mt-6 mb-1">
Buckets Buckets
@ -36,7 +20,7 @@
@push('scripts') @push('scripts')
<script type="text/javascript" src="/js/home.js"></script> <script type="text/javascript" src="/js/home.js"></script>
<script type="text/javascript" defer> <script type="text/javascript" defer>
riot.mount('buckets', {!! json_encode($buckets) !!});
riot.mount('buckets', {!! json_encode([ 'buckets' => $buckets ]) !!});
</script> </script>
@endpush @endpush


+ 22
- 14
resources/views/layout.blade.php View File

@ -10,20 +10,28 @@
<link rel="stylesheet" href="/css/bootstrap.css" /> <link rel="stylesheet" href="/css/bootstrap.css" />
</head> </head>
<body> <body>
<div>
@if (Route::has('login'))
<div>
@auth
<a href="{{ url('/home') }}" class="text-sm text-gray-700 underline">Home</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 underline">Login</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 underline">Register</a>
@endif
@endauth
</div>
@endif
</div>
<header class="app-header mb-4">
<div class="container is-fluid pt-2 pb-2">
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<img class="app-header__logo" src="/logo.svg" alt="Urban Filehub" />
<span class="app-header__title ml-2">
Filehub<strong>.Freifunk Minden</strong>
</span>
</a>
</div>
<div class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Dashboard
</a>
</div>
</div>
</nav>
</div>
</header>
<section class="section"> <section class="section">
<div class="container is-fluid mt-3 mb-4"> <div class="container is-fluid mt-3 mb-4">


+ 1
- 1
routes/web.php View File

@ -22,7 +22,7 @@ Route::get('/', 'App\Http\Controllers\HomeController@show');
Route::prefix('bucket')->group(function() { Route::prefix('bucket')->group(function() {
Route::get('create', 'App\Http\Controllers\BucketController@create')->name('bucket.create'); Route::get('create', 'App\Http\Controllers\BucketController@create')->name('bucket.create');
Route::post('create', 'App\Http\Controllers\BucketController@store'); Route::post('create', 'App\Http\Controllers\BucketController@store');
Route::get('{uuid}', 'App\Http\Controllers\BucketController@single')->name('bucket.single');
Route::get('{id}', 'App\Http\Controllers\BucketController@single')->name('bucket.single');
}); });
/*** /***


Loading…
Cancel
Save