Finished blade designs and methods and added sortable lists
This commit is contained in:
@@ -4,18 +4,25 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Beer;
|
use App\Models\Beer;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
|
||||||
class BeerController extends Controller
|
class BeerController extends Controller
|
||||||
{
|
{
|
||||||
public function show()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Beer $beer)
|
||||||
|
{
|
||||||
|
return view('beer.show', compact('beer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('beer.create');
|
$countries = DB::table('countries')->get();
|
||||||
|
return view('beer.create', compact('countries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
@@ -39,4 +46,42 @@ class BeerController extends Controller
|
|||||||
|
|
||||||
return back()->with('success', 'Beer added!');
|
return back()->with('success', 'Beer added!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function edit(Beer $beer)
|
||||||
|
{
|
||||||
|
$countries = DB::table('countries')->get();
|
||||||
|
return view('beer.edit', compact('beer', 'countries'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$this->validate($request, [
|
||||||
|
'beer' => 'required',
|
||||||
|
'rating' => 'required',
|
||||||
|
'country' => 'required',
|
||||||
|
'type' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$beer = Beer::findOrFail($id);
|
||||||
|
$beer->beer = $request->beer;
|
||||||
|
$beer->rating = $request->rating;
|
||||||
|
$beer->country = $request->country;
|
||||||
|
$beer->type = $request->type;
|
||||||
|
$beer->review = $request->review;
|
||||||
|
|
||||||
|
$beer->save();
|
||||||
|
|
||||||
|
return back()->with('success', 'Beer updated!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$beer = Beer::findOrFail($id);
|
||||||
|
|
||||||
|
$beer->list()->detach();
|
||||||
|
|
||||||
|
$beer->delete();
|
||||||
|
|
||||||
|
return view('profile')->with('success', 'Beer deleted');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,22 @@ use App\Models\Beer;
|
|||||||
use App\Models\BeerList;
|
use App\Models\BeerList;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class BeerListController extends Controller
|
class BeerListController extends Controller
|
||||||
{
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth')->except('show');
|
||||||
|
}
|
||||||
|
|
||||||
public function show(BeerList $list)
|
public function show(BeerList $list)
|
||||||
{
|
{
|
||||||
$beers = Beer::all();
|
$beers = Beer::all();
|
||||||
|
|
||||||
return view('list.show', compact('list', 'beers'));
|
$listBeers = $list->beer()->sortable()->paginate(5);
|
||||||
|
|
||||||
|
return view('list.show', compact('list', 'beers', 'listBeers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
@@ -43,6 +51,16 @@ class BeerListController extends Controller
|
|||||||
|
|
||||||
$list->beer()->attach($beerId);
|
$list->beer()->attach($beerId);
|
||||||
|
|
||||||
return redirect("/list/" . $list->id);
|
return back()->with('success', 'Beer added');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeItem(Request $request, $id)
|
||||||
|
{
|
||||||
|
$beerId = $request->beer;
|
||||||
|
$list = BeerList::findOrFail($id);
|
||||||
|
|
||||||
|
$list->beer()->detach($beerId);
|
||||||
|
|
||||||
|
return back()->with('success', 'Beer deleted');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,21 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Kyslik\ColumnSortable\Sortable;
|
||||||
|
|
||||||
class Beer extends Model
|
class Beer extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
use Sortable;
|
||||||
|
|
||||||
|
public $sortable = [
|
||||||
|
'beer',
|
||||||
|
'rating',
|
||||||
|
'country',
|
||||||
|
'type'
|
||||||
|
];
|
||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(BeerList::class, 'beer_list_pivot', 'beer_id', 'list_id');
|
return $this->belongsToMany(BeerList::class, 'beer_list_pivot', 'beer_id', 'list_id');
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
"php": "^7.3|^8.0",
|
"php": "^7.3|^8.0",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
|
"kyslik/column-sortable": "^6.4",
|
||||||
"laravel/framework": "^8.54",
|
"laravel/framework": "^8.54",
|
||||||
"laravel/sanctum": "^2.11",
|
"laravel/sanctum": "^2.11",
|
||||||
"laravel/tinker": "^2.5",
|
"laravel/tinker": "^2.5",
|
||||||
"laravel/ui": "^3.3"
|
"laravel/ui": "^3.3",
|
||||||
|
"webpatser/laravel-countries": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.5",
|
"facade/ignition": "^2.5",
|
||||||
|
|||||||
134
composer.lock
generated
134
composer.lock
generated
@@ -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": "f92dca6b0b8ca69708e45a35a49e4caf",
|
"content-hash": "e2b5b7e1fad18dd8c4e98f6b71e835af",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asm89/stack-cors",
|
"name": "asm89/stack-cors",
|
||||||
@@ -877,6 +877,67 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-06-30T20:03:07+00:00"
|
"time": "2021-06-30T20:03:07+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "kyslik/column-sortable",
|
||||||
|
"version": "6.4.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Kyslik/column-sortable.git",
|
||||||
|
"reference": "44f9da98acd31b2e871d0074bd638998990888b1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Kyslik/column-sortable/zipball/44f9da98acd31b2e871d0074bd638998990888b1",
|
||||||
|
"reference": "44f9da98acd31b2e871d0074bd638998990888b1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/database": "5.8.*|^6.0|^7.0|^8.0",
|
||||||
|
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0",
|
||||||
|
"php": ">=7.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^5.0",
|
||||||
|
"phpunit/phpunit": "^8.5"
|
||||||
|
},
|
||||||
|
"type": "package",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Kyslik\\ColumnSortable\\ColumnSortableServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Kyslik\\ColumnSortable\\": "src/ColumnSortable/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Martin Kiesel",
|
||||||
|
"email": "martin.kiesel@gmail.com",
|
||||||
|
"role": "Developer and maintainer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Package for handling column sorting in Laravel 6.x",
|
||||||
|
"keywords": [
|
||||||
|
"column",
|
||||||
|
"laravel",
|
||||||
|
"sort",
|
||||||
|
"sortable",
|
||||||
|
"sorting"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/Kyslik/column-sortable/issues",
|
||||||
|
"source": "https://github.com/Kyslik/column-sortable/tree/6.4.1"
|
||||||
|
},
|
||||||
|
"time": "2021-07-09T12:15:54+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v8.58.0",
|
"version": "v8.58.0",
|
||||||
@@ -5353,6 +5414,73 @@
|
|||||||
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
|
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
|
||||||
},
|
},
|
||||||
"time": "2021-03-09T10:59:23+00:00"
|
"time": "2021-03-09T10:59:23+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "webpatser/laravel-countries",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/webpatser/laravel-countries.git",
|
||||||
|
"reference": "9d656c32c3d92333ab00bd87761e8cd1f7245fb3"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/webpatser/laravel-countries/zipball/9d656c32c3d92333ab00bd87761e8cd1f7245fb3",
|
||||||
|
"reference": "9d656c32c3d92333ab00bd87761e8cd1f7245fb3",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Webpatser\\Countries\\CountriesServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Countries": "Webpatser\\Countries\\CountriesFacade"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Webpatser\\Countries": "src/"
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"src/commands"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Christoph Kempen",
|
||||||
|
"email": "christoph@downsized.nl",
|
||||||
|
"homepage": "http://downsized.nl/",
|
||||||
|
"role": "developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Paul Kievits",
|
||||||
|
"role": "developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries.",
|
||||||
|
"homepage": "https://github.com/webpatser/laravel-countries",
|
||||||
|
"keywords": [
|
||||||
|
"countries",
|
||||||
|
"iso_3166_2",
|
||||||
|
"iso_3166_3",
|
||||||
|
"laravel"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/webpatser/laravel-countries/issues",
|
||||||
|
"source": "https://github.com/webpatser/laravel-countries"
|
||||||
|
},
|
||||||
|
"time": "2019-07-12T14:06:05+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
@@ -7859,7 +7987,9 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"webpatser/laravel-countries": 20
|
||||||
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ return [
|
|||||||
Illuminate\Translation\TranslationServiceProvider::class,
|
Illuminate\Translation\TranslationServiceProvider::class,
|
||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
Illuminate\Validation\ValidationServiceProvider::class,
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
|
Webpatser\Countries\CountriesServiceProvider::class,
|
||||||
|
Kyslik\ColumnSortable\ColumnSortableServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
@@ -228,6 +230,8 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
'Countries' => Webpatser\Countries\CountriesFacade::class,
|
||||||
|
'Sortable' => Kyslik\ColumnSortable\ColumnSortableServiceProvider::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
121
config/columnsortable.php
Normal file
121
config/columnsortable.php
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
spec columns
|
||||||
|
*/
|
||||||
|
'columns' => [
|
||||||
|
'alpha' => [
|
||||||
|
'rows' => ['description', 'email', 'name', 'slug'],
|
||||||
|
'class' => 'fa fa-sort-alpha',
|
||||||
|
],
|
||||||
|
'amount' => [
|
||||||
|
'rows' => ['amount', 'price'],
|
||||||
|
'class' => 'fa fa-sort-amount',
|
||||||
|
],
|
||||||
|
'numeric' => [
|
||||||
|
'rows' => ['created_at', 'updated_at', 'level', 'id', 'phone_number'],
|
||||||
|
'class' => 'fa fa-sort-numeric',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
whether icons should be enabled
|
||||||
|
*/
|
||||||
|
'enable_icons' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
defines icon set to use when sorted data is none above (alpha nor amount nor numeric)
|
||||||
|
*/
|
||||||
|
'default_icon_set' => 'fa fa-sort',
|
||||||
|
|
||||||
|
/*
|
||||||
|
icon that shows when generating sortable link while column is not sorted
|
||||||
|
*/
|
||||||
|
'sortable_icon' => 'fa fa-sort',
|
||||||
|
|
||||||
|
/*
|
||||||
|
generated icon is clickable non-clickable (default)
|
||||||
|
*/
|
||||||
|
'clickable_icon' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
icon and text separator (any string)
|
||||||
|
in case of 'clickable_icon' => true; separator creates possibility to style icon and anchor-text properly
|
||||||
|
*/
|
||||||
|
'icon_text_separator' => ' ',
|
||||||
|
|
||||||
|
/*
|
||||||
|
suffix class that is appended when ascending direction is applied
|
||||||
|
*/
|
||||||
|
'asc_suffix' => '-asc',
|
||||||
|
|
||||||
|
/*
|
||||||
|
suffix class that is appended when descending direction is applied
|
||||||
|
*/
|
||||||
|
'desc_suffix' => '-desc',
|
||||||
|
|
||||||
|
/*
|
||||||
|
default anchor class, if value is null none is added
|
||||||
|
*/
|
||||||
|
'anchor_class' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
default active anchor class, if value is null none is added
|
||||||
|
*/
|
||||||
|
'active_anchor_class' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
default sort direction anchor class, if value is null none is added
|
||||||
|
*/
|
||||||
|
'direction_anchor_class_prefix' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
relation - column separator ex: detail.phone_number means relation "detail" and column "phone_number"
|
||||||
|
*/
|
||||||
|
'uri_relation_column_separator' => '.',
|
||||||
|
|
||||||
|
/*
|
||||||
|
formatting function applied to name of column, use null to turn formatting off
|
||||||
|
*/
|
||||||
|
'formatting_function' => 'ucfirst',
|
||||||
|
|
||||||
|
/*
|
||||||
|
apply formatting function to custom titles as well as column names
|
||||||
|
*/
|
||||||
|
'format_custom_titles' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
inject title parameter in query strings, use null to turn injection off
|
||||||
|
example: 'inject_title' => 't' will result in ..user/?t="formatted title of sorted column"
|
||||||
|
*/
|
||||||
|
'inject_title_as' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
allow request modification, when default sorting is set but is not in URI (first load)
|
||||||
|
*/
|
||||||
|
'allow_request_modification' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
default direction for: $user->sortable('id') usage
|
||||||
|
*/
|
||||||
|
'default_direction' => 'asc',
|
||||||
|
|
||||||
|
/*
|
||||||
|
default direction for non-sorted columns
|
||||||
|
*/
|
||||||
|
'default_direction_unsorted' => 'asc',
|
||||||
|
|
||||||
|
/*
|
||||||
|
use the first defined sortable column (Model::$sortable) as default
|
||||||
|
also applies if sorting parameters are invalid for example: 'sort' => 'name', 'direction' => ''
|
||||||
|
*/
|
||||||
|
'default_first_column' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
join type: join vs leftJoin (default leftJoin)
|
||||||
|
for more information see https://github.com/Kyslik/column-sortable/issues/59
|
||||||
|
*/
|
||||||
|
'join_type' => 'leftJoin',
|
||||||
|
];
|
||||||
13
config/countries.php
Normal file
13
config/countries.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The name of the table to create in the database
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'table_name' => 'countries',
|
||||||
|
];
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class SetupCountriesTable extends Migration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// Creates the users table
|
||||||
|
Schema::create(Config::get('countries.table_name'), function($table)
|
||||||
|
{
|
||||||
|
$table->integer('id')->unsigned()->index();
|
||||||
|
$table->string('capital', 255)->nullable();
|
||||||
|
$table->string('citizenship', 255)->nullable();
|
||||||
|
$table->string('country_code', 3)->default('');
|
||||||
|
$table->string('currency', 255)->nullable();
|
||||||
|
$table->string('currency_code', 255)->nullable();
|
||||||
|
$table->string('currency_sub_unit', 255)->nullable();
|
||||||
|
$table->string('currency_symbol', 3)->nullable();
|
||||||
|
$table->integer('currency_decimals')->nullable();
|
||||||
|
$table->string('full_name', 255)->nullable();
|
||||||
|
$table->string('iso_3166_2', 2)->default('');
|
||||||
|
$table->string('iso_3166_3', 3)->default('');
|
||||||
|
$table->string('name', 255)->default('');
|
||||||
|
$table->string('region_code', 3)->default('');
|
||||||
|
$table->string('sub_region_code', 3)->default('');
|
||||||
|
$table->boolean('eea')->default(0);
|
||||||
|
$table->string('calling_code', 3)->nullable();
|
||||||
|
$table->string('flag', 6)->nullable();
|
||||||
|
|
||||||
|
$table->primary('id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop(Config::get('countries.table_name'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CharifyCountriesTable extends Migration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table(\Config::get('countries.table_name'), function($table)
|
||||||
|
{
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY country_code CHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY iso_3166_2 CHAR(2) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY iso_3166_3 CHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY region_code CHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY sub_region_code CHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table(\Config::get('countries.table_name'), function($table)
|
||||||
|
{
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY country_code VARCHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY iso_3166_2 VARCHAR(2) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY iso_3166_3 VARCHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY region_code VARCHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " MODIFY sub_region_code VARCHAR(3) NOT NULL DEFAULT ''");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
43
database/seeders/CountriesSeeder.php
Normal file
43
database/seeders/CountriesSeeder.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use DB;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Webpatser\Countries\Countries;
|
||||||
|
|
||||||
|
class CountriesSeeder extends Seeder {
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run() {
|
||||||
|
//Empty the countries table
|
||||||
|
|
||||||
|
//Get all of the countries
|
||||||
|
$countryModel = new Countries();
|
||||||
|
$countries = $countryModel->getList();
|
||||||
|
foreach ($countries as $countryId => $country){
|
||||||
|
DB::table(\Config::get('countries.table_name'))->insert(array(
|
||||||
|
'id' => $countryId,
|
||||||
|
'capital' => ((isset($country['capital'])) ? $country['capital'] : null),
|
||||||
|
'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null),
|
||||||
|
'country_code' => $country['country-code'],
|
||||||
|
'currency' => ((isset($country['currency'])) ? $country['currency'] : null),
|
||||||
|
'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null),
|
||||||
|
'currency_sub_unit' => ((isset($country['currency_sub_unit'])) ? $country['currency_sub_unit'] : null),
|
||||||
|
'currency_decimals' => ((isset($country['currency_decimals'])) ? $country['currency_decimals'] : null),
|
||||||
|
'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null),
|
||||||
|
'iso_3166_2' => $country['iso_3166_2'],
|
||||||
|
'iso_3166_3' => $country['iso_3166_3'],
|
||||||
|
'name' => $country['name'],
|
||||||
|
'region_code' => $country['region-code'],
|
||||||
|
'sub_region_code' => $country['sub-region-code'],
|
||||||
|
'eea' => (bool)$country['eea'],
|
||||||
|
'calling_code' => $country['calling_code'],
|
||||||
|
'currency_symbol' => ((isset($country['currency_symbol'])) ? $country['currency_symbol'] : null),
|
||||||
|
'flag' =>((isset($country['flag'])) ? $country['flag'] : null),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
public/css/app.css
vendored
13
public/css/app.css
vendored
@@ -55,16 +55,7 @@ Improve consistency of default fonts in all browsers. (https://github.com/sindre
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family:
|
font-family: 'Titillium Web', sans-serif;
|
||||||
system-ui,
|
|
||||||
-apple-system, /* Firefox supports this but not yet `system-ui` */
|
|
||||||
'Segoe UI',
|
|
||||||
Roboto,
|
|
||||||
Helvetica,
|
|
||||||
Arial,
|
|
||||||
sans-serif,
|
|
||||||
'Apple Color Emoji',
|
|
||||||
'Segoe UI Emoji';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -356,7 +347,7 @@ ul {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */
|
font-family: 'Titillium Web', sans-serif;
|
||||||
line-height: 1.5; /* 2 */
|
line-height: 1.5; /* 2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,51 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<h1 class="my-20 text-3xl">
|
||||||
Create Beer
|
Create Beer
|
||||||
|
</h1>
|
||||||
<form method="POST" action="{{ route('beer.store') }}">
|
<form method="POST" action="{{ route('beer.store') }}">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="beer">
|
<label for="beer" class="text-lg">
|
||||||
Beer Name
|
Beer Name
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="beer">
|
<br>
|
||||||
<label for="rating">
|
<input type="text" name="beer" class="mb-4 w-1/5 outline-none pl-2">
|
||||||
|
<br>
|
||||||
|
<label for="rating" class="text-lg">
|
||||||
Rating
|
Rating
|
||||||
</label>
|
</label>
|
||||||
<input type="number" name="rating">
|
<br>
|
||||||
<label for="country">
|
<input type="number" min="0" max="10" step="0.5" name="rating" class="mb-4 w-1/5 outline-none pl-2">
|
||||||
|
<br>
|
||||||
|
<label for="country" class="text-lg">
|
||||||
Country
|
Country
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="country">
|
<br>
|
||||||
<label for="type">
|
<select name="country" class="mb-4 w-1/5 outline-none pl-2">
|
||||||
|
<option hidden>
|
||||||
|
-Country-
|
||||||
|
</option>
|
||||||
|
@foreach ($countries as $country)
|
||||||
|
<option value="{{ $country->name }}">
|
||||||
|
{{ $country->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<br>
|
||||||
|
<label for="type" class="text-lg">
|
||||||
Beer Type
|
Beer Type
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="type">
|
<br>
|
||||||
<label for="review">
|
<input type="text" name="type" class="mb-4 w-1/5 outline-none pl-2">
|
||||||
|
<br>
|
||||||
|
<label for="review" class="text-lg">
|
||||||
Review
|
Review
|
||||||
</label>
|
</label>
|
||||||
<textarea name="review" style="resize:none"></textarea>
|
<br>
|
||||||
< <button type="submit">Add Beer</button>
|
<textarea name="review" class="resize-none w-1/4 h-60 outline-none pl-2"></textarea>
|
||||||
|
<br>
|
||||||
|
<button type="submit" class="text-lg mt-6 bg-yellow-700 px-2 py-1 rounded-md text-white">Add Beer</button>
|
||||||
</form>
|
</form>
|
||||||
@if (session()->has('success'))
|
@if (session()->has('success'))
|
||||||
<p class="text-green-400">{{ session()->get('success') }}</p>
|
<p class="text-green-400">{{ session()->get('success') }}</p>
|
||||||
|
|||||||
54
resources/views/beer/edit.blade.php
Normal file
54
resources/views/beer/edit.blade.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1 class="text-3xl my-20">
|
||||||
|
Edit Beer
|
||||||
|
</h1>
|
||||||
|
<form method="POST" action="{{ route('beer.update', $beer->id) }}">
|
||||||
|
@csrf
|
||||||
|
@method('PATCH')
|
||||||
|
<label for="beer" class="text-lg">
|
||||||
|
Beer Name
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<input type="text" name="beer" class="mb-4 w-1/5 outline-none pl-2" value="{{ $beer->beer ?? old('beer') }}">
|
||||||
|
<br>
|
||||||
|
<label for="rating" class="text-lg">
|
||||||
|
Rating
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<input type="number" min="0" max="10" step="0.5" name="rating" class="mb-4 w-1/5 outline-none pl-2" value="{{ $beer->rating ?? old('rating') }}">
|
||||||
|
<br>
|
||||||
|
<label for="country" class="text-lg">
|
||||||
|
Country
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<select name="country" class="mb-4 w-1/5 outline-none pl-2">
|
||||||
|
<option selected value="{{ $beer->country }}">
|
||||||
|
{{ $beer->country }}
|
||||||
|
</option>
|
||||||
|
@foreach ($countries as $country)
|
||||||
|
<option value="{{ $country->name }}">
|
||||||
|
{{ $country->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<br>
|
||||||
|
<label for="type" class="text-lg">
|
||||||
|
Beer Type
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<input type="text" name="type" class="mb-4 w-1/5 outline-none pl-2" value="{{ $beer->type ?? old('type') }}">
|
||||||
|
<br>
|
||||||
|
<label for="review" class="text-lg">
|
||||||
|
Review
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<textarea name="review" class="resize-none w-1/4 h-60 outline-none pl-2">{{ $beer->review ?? old('review') }}</textarea>
|
||||||
|
<br>
|
||||||
|
<button type="submit" class="text-lg mt-6 bg-blue-700 px-2 py-1 rounded-md text-white">Update Beer</button>
|
||||||
|
</form>
|
||||||
|
@if (session()->has('success'))
|
||||||
|
<p class="text-green-400">{{ session()->get('success') }}</p>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
@@ -1,5 +1,34 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<h1 class="text-3xl">
|
||||||
|
{{ $beer->beer }}
|
||||||
|
</h1>
|
||||||
|
<p class="text-xl my-4">
|
||||||
|
Rating: <br>
|
||||||
|
<span class="text-white"> {{ $beer->rating }} </span>
|
||||||
|
</p>
|
||||||
|
<p class="text-xl">
|
||||||
|
Country: <br>
|
||||||
|
<span class="text-white"> {{ $beer->country }} </span>
|
||||||
|
</p>
|
||||||
|
<p class="text-xl my-4">
|
||||||
|
Type: <br>
|
||||||
|
<span class="text-white"> {{ $beer->type }} </span>
|
||||||
|
</p>
|
||||||
|
<p class="text-xl">
|
||||||
|
Review: <br>
|
||||||
|
<span class="text-white"> {{ $beer->review ?? '[No review added]' }} </span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form class="mt-10" method="POST" action="{{ route('beer.destroy', $beer->id) }}">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button class="bg-red-700 rounded-md px-2 py-1" type="submit" onclick="return confirm('Are you sure?')">
|
||||||
|
Delete beer
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -16,6 +16,9 @@
|
|||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link href="{{ asset('/css/app.css') }}" rel="stylesheet">
|
<link href="{{ asset('/css/app.css') }}" rel="stylesheet">
|
||||||
@@ -24,15 +27,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app" class="bg-gray-600 min-h-screen">
|
<div id="app" class="bg-gray-600 min-h-screen">
|
||||||
<nav>
|
<nav>
|
||||||
<a class="" href="{{ url('/') }}">
|
|
||||||
{{ config('app.name', 'Laravel') }}
|
|
||||||
</a>
|
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
|
||||||
data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
|
|
||||||
aria-label="{{ __('Toggle navigation') }}">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<!-- Left Side Of Navbar -->
|
<!-- Left Side Of Navbar -->
|
||||||
@@ -57,18 +53,17 @@
|
|||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button"
|
<a href="/profile">
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
Logged in as <span class="font-bold"> {{ Auth::user()->name }}</span>
|
||||||
{{ Auth::user()->name }}
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault();
|
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault();
|
||||||
document.getElementById('logout-form').submit();">
|
document.getElementById('logout-form').submit();">
|
||||||
{{ __('Logout') }}
|
{{ __('Logout') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
<form id="logout-form" action="{{ route('logout') }}" method="POST"
|
||||||
|
class="d-none">
|
||||||
@csrf
|
@csrf
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<h1 class="my-20 text-3xl">
|
||||||
Add list
|
Add list
|
||||||
|
</h1>
|
||||||
<form method="POST" action="{{ route('list.store') }}">
|
<form method="POST" action="{{ route('list.store') }}">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="title">
|
<label for="title" class="text-lg">
|
||||||
List Name
|
List Name
|
||||||
</label>
|
</label>
|
||||||
<input class="bg-gray-300 border-black border-1" type="text" name="title">
|
<input class="bg-gray-300 border-black border-2" type="text" name="title">
|
||||||
@if ($errors->has('title'))
|
@if ($errors->has('title'))
|
||||||
<span class="text-red-600" role="alert">
|
<span class="text-red-600" role="alert">
|
||||||
<strong>{{ $errors->first('title') }}</strong>
|
<strong>{{ $errors->first('title') }}</strong>
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
<button type="submit">
|
<br>
|
||||||
|
<button type="submit" class="text-lg mt-6 bg-green-700 px-2 py-1 rounded-md text-white">
|
||||||
Add List
|
Add List
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<div class="justify-center mx-auto">
|
||||||
|
<h1 class="text-4xl my-20">
|
||||||
{{ $list->title }}
|
{{ $list->title }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
<form method="POST" action="{{ route('list.additem', $list->id) }}">
|
<form method="POST" action="{{ route('list.additem', $list->id) }}">
|
||||||
@csrf
|
@csrf
|
||||||
<select name="beer">
|
<select name="beer" required>
|
||||||
<option hidden>
|
<option hidden>
|
||||||
-Add Beer-
|
-Add Beer-
|
||||||
</option>
|
</option>
|
||||||
@@ -23,48 +26,72 @@
|
|||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<button type="submit">
|
<br>
|
||||||
|
<button type="submit" class="text-lg mt-6 bg-green-700 px-2 py-1 rounded-md text-white">
|
||||||
Add beer
|
Add beer
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<table class="border-2 border-black text-center my-10">
|
<table class="mx-auto border-2 border-black text-center my-10">
|
||||||
<tr>
|
<tr class="border-black border-2 text-xl">
|
||||||
<th class="px-2">
|
<th class="border-black border-r-2 px-4">
|
||||||
Beer
|
@sortablelink('beer')
|
||||||
|
<img class="w-1/6 float-right mt-1" src="/storage/sort-arrows-couple-pointing-up-and-down.png"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="px-2">
|
<th class="border-black border-r-2 px-4">
|
||||||
Rating
|
@sortablelink('rating')
|
||||||
|
<img class="w-1/6 float-right mt-1" src="/storage/sort-arrows-couple-pointing-up-and-down.png"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="px-2">
|
<th class="border-black border-r-2 px-4">
|
||||||
Country
|
@sortablelink('country')
|
||||||
|
<img class="w-1/6 float-right mt-1" src="/storage/sort-arrows-couple-pointing-up-and-down.png"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="px-2">
|
<th class="border-black border-r-2 px-4">
|
||||||
Type
|
@sortablelink('type')
|
||||||
|
<img class="w-1/6 float-right mt-1" src="/storage/sort-arrows-couple-pointing-up-and-down.png"/>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@foreach ($listBeers as $beer)
|
||||||
|
<tr class="border-black border-2 text-lg">
|
||||||
@foreach ($list->beer as $beer)
|
<td class="border-black border-r-2 px-4 underline hover:no-underline">
|
||||||
<tr>
|
<a href="{{ route('beer.show', $beer->id) }}">
|
||||||
<td>
|
|
||||||
{{ $beer->beer }}
|
{{ $beer->beer }}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="border-black border-r-2 px-4">
|
||||||
{{ $beer->rating }}
|
{{ $beer->rating }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="border-black border-r-2 px-4">
|
||||||
{{ $beer->country }}
|
{{ $beer->country }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="border-black border-r-2 px-4">
|
||||||
{{ $beer->type }}
|
{{ $beer->type }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="border-black border-r-2 px-4 bg-blue-700">
|
||||||
|
<a href="{{ route('beer.edit', $beer->id) }}">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class="border-black border-r-2 px-4 bg-red-700">
|
||||||
|
<form method="POST" action="{{ route('list.removeitem', $list->id) }}">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<input name="beer" hidden value="{{ $beer->id }}" />
|
||||||
|
<button onclick="return confirm('Are you sure?')" type="submit">
|
||||||
|
Remove
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@if (session()->has('success'))
|
||||||
|
<p class="text-green-400 my-4">{{ Session::get('success') }}</p>
|
||||||
|
@endif
|
||||||
|
<button class="text-lg mt-6 bg-yellow-700 px-2 py-1 rounded-md text-white">
|
||||||
<a href="{{ route('beer.create') }}">
|
<a href="{{ route('beer.create') }}">
|
||||||
Can't find your beer?
|
Can't find your beer?
|
||||||
</a>
|
</a>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,15 +1,41 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<h2 class="
|
||||||
Profile
|
md:text-3xl text-xl md:text-left text-center mt-20">
|
||||||
</div>
|
Profile of {{ Auth::user()->name }}
|
||||||
|
</h2>
|
||||||
|
<button class="text-lg mt-6 bg-green-700 px-2 py-1 rounded-md text-white">
|
||||||
<a href="{{ route('list.create') }}">
|
<a href="{{ route('list.create') }}">
|
||||||
Add Beer list
|
Add Beer list
|
||||||
</a>
|
</a>
|
||||||
|
</button>
|
||||||
|
<h2 class="my-10 text-2xl">
|
||||||
|
Beer Lists
|
||||||
|
</h2>
|
||||||
|
<table class="border-black border-2 text-center">
|
||||||
|
<tr class="border-black border-2 text-xl">
|
||||||
|
<th class="border-black border-r-2 px-4">
|
||||||
|
List name
|
||||||
|
</th>
|
||||||
|
<th class="px-4">
|
||||||
|
Beer Count
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
@foreach (Auth::user()->lists as $list)
|
@foreach (Auth::user()->lists as $list)
|
||||||
|
<tr class="border-black border-2 text-lg">
|
||||||
|
<td class="border-black border-r-2 px-4 underline hover:no-underline">
|
||||||
<a href="{{ route('list.show', $list->id) }}">
|
<a href="{{ route('list.show', $list->id) }}">
|
||||||
{{ $list->title }}
|
{{ $list->title }}
|
||||||
</a>
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class="px-4">
|
||||||
|
{{ $list->beer()->count() }}
|
||||||
|
</td>
|
||||||
|
<tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@if (session()->has('success'))
|
||||||
|
<p class="text-green-400">{{ session()->get('success') }}</p>
|
||||||
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: 'Nunito', sans-serif;
|
font-family: 'Titillium Web', sans-serif;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -36,97 +36,9 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
|
<h1 class="text-center text-4xl">
|
||||||
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
|
Beer Review Application
|
||||||
<svg viewBox="0 0 651 192" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-16 w-auto text-gray-700 sm:h-20">
|
</h1>
|
||||||
<g clip-path="url(#clip0)" fill="#EF3B2D">
|
|
||||||
<path d="M248.032 44.676h-16.466v100.23h47.394v-14.748h-30.928V44.676zM337.091 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.431 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162-.001 2.863-.479 5.584-1.432 8.161zM463.954 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.432 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162 0 2.863-.479 5.584-1.432 8.161zM650.772 44.676h-15.606v100.23h15.606V44.676zM365.013 144.906h15.607V93.538h26.776V78.182h-42.383v66.724zM542.133 78.182l-19.616 51.096-19.616-51.096h-15.808l25.617 66.724h19.614l25.617-66.724h-15.808zM591.98 76.466c-19.112 0-34.239 15.706-34.239 35.079 0 21.416 14.641 35.079 36.239 35.079 12.088 0 19.806-4.622 29.234-14.688l-10.544-8.158c-.006.008-7.958 10.449-19.832 10.449-13.802 0-19.612-11.127-19.612-16.884h51.777c2.72-22.043-11.772-40.877-33.023-40.877zm-18.713 29.28c.12-1.284 1.917-16.884 18.589-16.884 16.671 0 18.697 15.598 18.813 16.884h-37.402zM184.068 43.892c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002-35.648-20.524a2.971 2.971 0 00-2.964 0l-35.647 20.522-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v38.979l-29.706 17.103V24.493a3 3 0 00-.103-.776c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002L40.098 1.396a2.971 2.971 0 00-2.964 0L1.487 21.919l-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v122.09c0 1.063.568 2.044 1.489 2.575l71.293 41.045c.156.089.324.143.49.202.078.028.15.074.23.095a2.98 2.98 0 001.524 0c.069-.018.132-.059.2-.083.176-.061.354-.119.519-.214l71.293-41.045a2.971 2.971 0 001.489-2.575v-38.979l34.158-19.666a2.971 2.971 0 001.489-2.575V44.666a3.075 3.075 0 00-.106-.774zM74.255 143.167l-29.648-16.779 31.136-17.926.001-.001 34.164-19.669 29.674 17.084-21.772 12.428-43.555 24.863zm68.329-76.259v33.841l-12.475-7.182-17.231-9.92V49.806l12.475 7.182 17.231 9.92zm2.97-39.335l29.693 17.095-29.693 17.095-29.693-17.095 29.693-17.095zM54.06 114.089l-12.475 7.182V46.733l17.231-9.92 12.475-7.182v74.537l-17.231 9.921zM38.614 7.398l29.693 17.095-29.693 17.095L8.921 24.493 38.614 7.398zM5.938 29.632l12.475 7.182 17.231 9.92v79.676l.001.005-.001.006c0 .114.032.221.045.333.017.146.021.294.059.434l.002.007c.032.117.094.222.14.334.051.124.088.255.156.371a.036.036 0 00.004.009c.061.105.149.191.222.288.081.105.149.22.244.314l.008.01c.084.083.19.142.284.215.106.083.202.178.32.247l.013.005.011.008 34.139 19.321v34.175L5.939 144.867V29.632h-.001zm136.646 115.235l-65.352 37.625V148.31l48.399-27.628 16.953-9.677v33.862zm35.646-61.22l-29.706 17.102V66.908l17.231-9.92 12.475-7.182v33.841z"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
|
||||||
<div class="p-6">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-8 h-8 text-gray-500"><path d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"></path></svg>
|
|
||||||
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel.com/docs" class="underline text-gray-900 dark:text-white">Documentation</a></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ml-12">
|
|
||||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
|
||||||
Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-t-0 md:border-l">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-8 h-8 text-gray-500"><path d="M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"></path><path d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
|
|
||||||
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laracasts.com" class="underline text-gray-900 dark:text-white">Laracasts</a></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ml-12">
|
|
||||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
|
||||||
Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-6 border-t border-gray-200 dark:border-gray-700">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-8 h-8 text-gray-500"><path d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"></path></svg>
|
|
||||||
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel-news.com/" class="underline text-gray-900 dark:text-white">Laravel News</a></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ml-12">
|
|
||||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
|
||||||
Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-l">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-8 h-8 text-gray-500"><path d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
|
||||||
<div class="ml-4 text-lg leading-7 font-semibold text-gray-900 dark:text-white">Vibrant Ecosystem</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ml-12">
|
|
||||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
|
||||||
Laravel's robust library of first-party tools and libraries, such as <a href="https://forge.laravel.com" class="underline">Forge</a>, <a href="https://vapor.laravel.com" class="underline">Vapor</a>, <a href="https://nova.laravel.com" class="underline">Nova</a>, and <a href="https://envoyer.io" class="underline">Envoyer</a> help you take your projects to the next level. Pair them with powerful open source libraries like <a href="https://laravel.com/docs/billing" class="underline">Cashier</a>, <a href="https://laravel.com/docs/dusk" class="underline">Dusk</a>, <a href="https://laravel.com/docs/broadcasting" class="underline">Echo</a>, <a href="https://laravel.com/docs/horizon" class="underline">Horizon</a>, <a href="https://laravel.com/docs/sanctum" class="underline">Sanctum</a>, <a href="https://laravel.com/docs/telescope" class="underline">Telescope</a>, and more.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex justify-center mt-4 sm:items-center sm:justify-between">
|
|
||||||
<div class="text-center text-sm text-gray-500 sm:text-left">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" class="-mt-px w-5 h-5 text-gray-400">
|
|
||||||
<path d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
<a href="https://laravel.bigcartel.com" class="ml-1 underline">
|
|
||||||
Shop
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="ml-4 -mt-px w-5 h-5 text-gray-400">
|
|
||||||
<path d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
<a href="https://github.com/sponsors/taylorotwell" class="ml-1 underline">
|
|
||||||
Sponsor
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0">
|
|
||||||
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -31,7 +31,12 @@ Route::get('/create-list', [BeerListController::class, 'create'])->name('list.cr
|
|||||||
Route::get('/list/{list}', [BeerListController::class, 'show'])->name('list.show');
|
Route::get('/list/{list}', [BeerListController::class, 'show'])->name('list.show');
|
||||||
Route::post('/create-list', [BeerListController::class, 'store'])->name('list.store');
|
Route::post('/create-list', [BeerListController::class, 'store'])->name('list.store');
|
||||||
Route::post('/add-item/{list}', [BeerListController::class, 'addItem'])->name('list.additem');
|
Route::post('/add-item/{list}', [BeerListController::class, 'addItem'])->name('list.additem');
|
||||||
|
Route::delete('/remove-item/{list}', [BeerListController::class, 'removeItem'])->name('list.removeitem');
|
||||||
|
|
||||||
//Beer Routes
|
//Beer Routes
|
||||||
Route::get('/create-beer', [BeerController::class, 'create'])->name('beer.create');
|
Route::get('/create-beer', [BeerController::class, 'create'])->name('beer.create');
|
||||||
|
Route::get('/beer/{beer}', [BeerController::class, 'show'])->name('beer.show');
|
||||||
|
Route::get('/beer/{beer}/edit', [BeerController::class, 'edit'])->name('beer.edit');
|
||||||
Route::post('/create-beer', [BeerController::class, 'store'])->name('beer.store');
|
Route::post('/create-beer', [BeerController::class, 'store'])->name('beer.store');
|
||||||
|
Route::patch('/beer/{beer}', [BeerController::class, 'update'])->name('beer.update');
|
||||||
|
Route::delete('/beer/{beer}', [BeerController::class, 'destroy'])->name('beer.destroy');
|
||||||
|
|||||||
Reference in New Issue
Block a user