Merge branch 'admin'
This commit is contained in:
commit
a061c8b713
51 changed files with 1612 additions and 21 deletions
13
app/Http/Controllers/Admin/AdminController.php
Normal file
13
app/Http/Controllers/Admin/AdminController.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view("admin.admin.index");
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Admin/CardController.php
Normal file
29
app/Http/Controllers/Admin/CardController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Card;
|
||||
use App\Http\Livewire\Form\CardForm;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class CardController extends Controller
|
||||
{
|
||||
static public function getForm() : string
|
||||
{
|
||||
return CardForm::class;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('admin.card.index');
|
||||
}
|
||||
|
||||
public function destroy(Card $card)
|
||||
{
|
||||
$card->delete();
|
||||
|
||||
return redirect()->route('admin.card.index')
|
||||
->with('info', __("Card #:id was deleted.", [ 'id' => $card->id ]));
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Admin/CharacterController.php
Normal file
29
app/Http/Controllers/Admin/CharacterController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Character;
|
||||
use App\Http\Livewire\Form\CharacterForm;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class CharacterController extends Controller
|
||||
{
|
||||
static public function getForm() : string
|
||||
{
|
||||
return CharacterForm::class;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view("admin.character.index");
|
||||
}
|
||||
|
||||
public function destroy(Character $character)
|
||||
{
|
||||
$character->delete();
|
||||
|
||||
return redirect()->route('admin.character.index')
|
||||
->with('info', __("Character #:id was deleted.", [ 'id' => $character->id ]));
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Admin/RaidController.php
Normal file
29
app/Http/Controllers/Admin/RaidController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Raid;
|
||||
use App\Http\Livewire\Form\RaidForm;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class RaidController extends Controller
|
||||
{
|
||||
static public function getForm() : string
|
||||
{
|
||||
return RaidForm::class;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view("admin.raid.index");
|
||||
}
|
||||
|
||||
public function destroy(Raid $raid)
|
||||
{
|
||||
$raid->delete();
|
||||
|
||||
return redirect()->route('admin.raid.index')
|
||||
->with('info', __("Raid #:id was deleted.", [ 'id' => $raid->id ]));
|
||||
}
|
||||
}
|
||||
36
app/Http/Controllers/AuthController.php
Normal file
36
app/Http/Controllers/AuthController.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show login page
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an authenticated session.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
Auth::guard('admin')->logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -34,4 +34,15 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class
|
||||
];
|
||||
}
|
||||
|
|
|
|||
58
app/Http/Livewire/AlertContainer.php
Normal file
58
app/Http/Livewire/AlertContainer.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Livewire\Component;
|
||||
|
||||
class AlertContainer extends Component
|
||||
{
|
||||
/**
|
||||
* List of alert types.
|
||||
*/
|
||||
protected array $_types = [
|
||||
'info',
|
||||
'success',
|
||||
'warning',
|
||||
'danger'
|
||||
];
|
||||
|
||||
/**
|
||||
* Event listeners
|
||||
*/
|
||||
protected $listeners = [
|
||||
// Add message when "alert" event is fired.
|
||||
'alert' => 'addMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Alert messages.
|
||||
*/
|
||||
public array $messages = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// Load messages from session
|
||||
foreach($this->_types as $type) {
|
||||
if (Session::has($type)) {
|
||||
$this->addMessage($type, Session::get($type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the container.
|
||||
*/
|
||||
public function addMessage(string $type, string $message)
|
||||
{
|
||||
$this->messages[] = [ $type, $message ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the messages
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.alert-container');
|
||||
}
|
||||
}
|
||||
93
app/Http/Livewire/Datatable.php
Normal file
93
app/Http/Livewire/Datatable.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Datatable extends Component
|
||||
{
|
||||
use WithPagination, Traits\WithSort;
|
||||
|
||||
/**
|
||||
* Query string settings.
|
||||
*/
|
||||
protected $queryString = [
|
||||
'sort' => ['except' => 'id'],
|
||||
'dir' => ['except' => 'asc'],
|
||||
'page' => ['except' => 1]
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to get data from.
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Array of columns to show
|
||||
*/
|
||||
public array $columns;
|
||||
|
||||
/**
|
||||
* What colums are sortable
|
||||
*/
|
||||
public array $sort_columns;
|
||||
|
||||
/**
|
||||
* Route for editing a record (if null, link is omitted)
|
||||
*/
|
||||
public $route_edit;
|
||||
|
||||
/**
|
||||
* Route for deleting a record (if null, link is omitted)
|
||||
*/
|
||||
public $route_delete;
|
||||
|
||||
/**
|
||||
* How many records should be displayed on one page.
|
||||
*/
|
||||
public int $itemsPerPage = 30;
|
||||
|
||||
public function mount(string $model, array $columns, array $sort_columns = [],
|
||||
$default_sort = '', $route_delete = null, $route_edit = null)
|
||||
{
|
||||
$this->model = app()->make($model);
|
||||
$this->sort = $default_sort;
|
||||
$this->sort_columns = $sort_columns;
|
||||
$this->route_edit = $route_edit;
|
||||
$this->route_delete = $route_delete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the datatable
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$query = $this->model->query();
|
||||
|
||||
// Check colums for "dot-notated" strings.
|
||||
// as we want to eager load those relationships
|
||||
foreach ($this->columns as $col => $_) {
|
||||
$p = strrpos($col, '.');
|
||||
if ($p !== false) {
|
||||
$rel = substr($col, 0, $p);
|
||||
$query->with($rel);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply sorting.
|
||||
$this->sortApply($query);
|
||||
|
||||
$items = $query->paginate($this->itemsPerPage);
|
||||
|
||||
return view('livewire.datatable', ['items' => $items]);
|
||||
}
|
||||
|
||||
public function getRouteKeyProperty()
|
||||
{
|
||||
return Str::slug(get_class($this->model));
|
||||
}
|
||||
}
|
||||
60
app/Http/Livewire/Form/CardForm.php
Normal file
60
app/Http/Livewire/Form/CardForm.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Form;
|
||||
|
||||
use App\Models\Card;
|
||||
use App\Models\Character;
|
||||
use App\Models\Raid;
|
||||
use App\Models\Wow;
|
||||
|
||||
class CardForm extends ModelForm
|
||||
{
|
||||
/**
|
||||
* Array of available characters
|
||||
*/
|
||||
public $characters;
|
||||
|
||||
/**
|
||||
* Array of available raids
|
||||
*/
|
||||
public $raids;
|
||||
|
||||
/**
|
||||
* Redirect after this route after record was created.
|
||||
*/
|
||||
public string $redirect_route = 'admin.card.index';
|
||||
|
||||
public function mount(Card $card)
|
||||
{
|
||||
$this->record = $card;
|
||||
$this->characters = Character::all()->pluck('name', 'id');
|
||||
$this->raids = Raid::all()->pluck('name', 'id');
|
||||
$this->classes = Wow::$classes;
|
||||
$this->exist = $card->exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*/
|
||||
protected function rules()
|
||||
{
|
||||
return [
|
||||
'record.body' => 'required|string|min:3|max:200',
|
||||
'record.character_id' => 'exists:' . Character::class . ',id|nullable',
|
||||
'record.raid_id' => 'exists:' . Raid::class . ',id|nullable',
|
||||
'record.class' => 'in:' . collect($this->classes)->keys() . '|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
public function updated($property, $value)
|
||||
{
|
||||
// Hack to force empty value to null.
|
||||
if (in_array($property, ['record.character_id', 'record.raid_id', 'record.class'])) {
|
||||
if (empty($value)) {
|
||||
$this->{$property} = null;
|
||||
}
|
||||
}
|
||||
|
||||
$this->validateOnly($property);
|
||||
}
|
||||
}
|
||||
29
app/Http/Livewire/Form/CharacterForm.php
Normal file
29
app/Http/Livewire/Form/CharacterForm.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Form;
|
||||
|
||||
use App\Models\Character;
|
||||
|
||||
class CharacterForm extends ModelForm
|
||||
{
|
||||
/**
|
||||
* Redirect after this route after record was created.
|
||||
*/
|
||||
public string $redirect_route = 'admin.character.index';
|
||||
|
||||
public function mount(Character $character)
|
||||
{
|
||||
$this->record = $character;
|
||||
$this->exist = $character->exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*/
|
||||
protected function rules()
|
||||
{
|
||||
return [
|
||||
'record.name' => 'required|string|min:3|max:14',
|
||||
];
|
||||
}
|
||||
}
|
||||
43
app/Http/Livewire/Form/LoginForm.php
Normal file
43
app/Http/Livewire/Form/LoginForm.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Form;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoginForm extends Component
|
||||
{
|
||||
public $username;
|
||||
|
||||
public $password;
|
||||
|
||||
protected $rules = [
|
||||
'username' => 'required|string|min:3',
|
||||
'password' => 'required|string',
|
||||
];
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
$cred = [
|
||||
'username' => $this->username,
|
||||
'password' => $this->password
|
||||
];
|
||||
|
||||
if (!Auth::attempt($cred)) {
|
||||
session()->flash('message', __('auth.failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
return redirect()->intended('/admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the setup page
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('form.login');
|
||||
}
|
||||
}
|
||||
76
app/Http/Livewire/Form/ModelForm.php
Normal file
76
app/Http/Livewire/Form/ModelForm.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Form;
|
||||
|
||||
use App\Http\Livewire\Traits\Alert;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
abstract class ModelForm extends Component
|
||||
{
|
||||
use Alert;
|
||||
|
||||
/**
|
||||
* The model record
|
||||
*/
|
||||
public $record;
|
||||
|
||||
/**
|
||||
* True if the record already exists in the database.
|
||||
*/
|
||||
public bool $exist;
|
||||
|
||||
/**
|
||||
* Redirect after this route after record was created.
|
||||
*/
|
||||
public string $redirect_route;
|
||||
|
||||
/**
|
||||
* Get the name of the model
|
||||
*/
|
||||
public function getModelName() : string
|
||||
{
|
||||
return Str::afterLast(get_class($this->record), '\\');
|
||||
}
|
||||
|
||||
public function updated($property, $value)
|
||||
{
|
||||
$this->validateOnly($property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this record has not been stored in the database.
|
||||
*/
|
||||
public function isNew() : bool
|
||||
{
|
||||
return !$this->exist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the form, create/update record.
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
$this->record->save();
|
||||
|
||||
if ($this->isNew()) {
|
||||
return redirect()->route($this->redirect_route)
|
||||
->with('info', __("{$this->getModelName()} was successfully created."));
|
||||
}
|
||||
|
||||
$this->info(__("{$this->getModelName()} was successfully updated."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the setup page
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$script = Str::lower($this->getModelName());
|
||||
|
||||
return view("form.$script")
|
||||
->layout('layouts.admin');
|
||||
}
|
||||
}
|
||||
29
app/Http/Livewire/Form/RaidForm.php
Normal file
29
app/Http/Livewire/Form/RaidForm.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Form;
|
||||
|
||||
use App\Models\Raid;
|
||||
|
||||
class RaidForm extends ModelForm
|
||||
{
|
||||
/**
|
||||
* Redirect after this route after record was created.
|
||||
*/
|
||||
public string $redirect_route = 'admin.raid.index';
|
||||
|
||||
public function mount(Raid $raid)
|
||||
{
|
||||
$this->record = $raid;
|
||||
$this->exist = $raid->exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*/
|
||||
protected function rules()
|
||||
{
|
||||
return [
|
||||
'record.name' => 'required|string|min:2|max:20',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Livewire/Traits/Alert.php
Normal file
46
app/Http/Livewire/Traits/Alert.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Traits;
|
||||
|
||||
trait Alert
|
||||
{
|
||||
/**
|
||||
* Add an info alert
|
||||
*/
|
||||
public function info($message)
|
||||
{
|
||||
$this->alert('info', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an success alert
|
||||
*/
|
||||
public function success($message)
|
||||
{
|
||||
$this->alert('success', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an warning alert
|
||||
*/
|
||||
public function warning($message)
|
||||
{
|
||||
$this->alert('warning', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an danger alert
|
||||
*/
|
||||
public function danger($message)
|
||||
{
|
||||
$this->alert('danger', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an alert
|
||||
*/
|
||||
public function alert($type, $message)
|
||||
{
|
||||
$this->emit('alert', $type, $message);
|
||||
}
|
||||
}
|
||||
51
app/Http/Livewire/Traits/WithSort.php
Normal file
51
app/Http/Livewire/Traits/WithSort.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Traits;
|
||||
|
||||
trait WithSort {
|
||||
|
||||
/**
|
||||
* Sort column
|
||||
*/
|
||||
public string $sort = '';
|
||||
|
||||
/**
|
||||
* Sort direction
|
||||
*/
|
||||
public string $dir = 'asc';
|
||||
|
||||
/**
|
||||
* Sort by column.
|
||||
*/
|
||||
public function sort($column)
|
||||
{
|
||||
if (!array_key_exists($column, $this->sort_columns)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->sort === $column) {
|
||||
$this->dir = $this->dir === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
$this->sort = $column;
|
||||
$this->reset('dir');
|
||||
}
|
||||
}
|
||||
|
||||
protected function sortApply($query)
|
||||
{
|
||||
// No sorting. bail out.
|
||||
if (!strlen($this->sort)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$columns = $this->sort_columns[$this->sort];
|
||||
|
||||
if (!is_array($columns)) {
|
||||
$columns = [ $columns ];
|
||||
}
|
||||
|
||||
foreach($columns as $column) {
|
||||
$query->orderBy($column, $this->dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
31
app/Models/Admin.php
Normal file
31
app/Models/Admin.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Admin extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'password'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ class Card extends Model
|
|||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $appends = ['subject'];
|
||||
protected $appends = ['subject', 'subject_type'];
|
||||
|
||||
public $fillable = [
|
||||
'body',
|
||||
|
|
@ -57,6 +57,21 @@ class Card extends Model
|
|||
return "Somebody";
|
||||
}
|
||||
|
||||
/**
|
||||
* Who, Where or What this card belongs to.
|
||||
*/
|
||||
public function getSubjectTypeAttribute()
|
||||
{
|
||||
if ($this->character) {
|
||||
return "Character";
|
||||
} else if ($this->class) {
|
||||
return "Class";
|
||||
} else if ($this->role) {
|
||||
return "Roll";
|
||||
}
|
||||
return "Anyone";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cards depending on settings.
|
||||
*/
|
||||
|
|
|
|||
21
app/Models/Wow.php
Normal file
21
app/Models/Wow.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Wow
|
||||
{
|
||||
/**
|
||||
* Enum for classes.
|
||||
*/
|
||||
static public $classes = [
|
||||
'warrior' => 'Warrior',
|
||||
'rogue' => 'Rogue',
|
||||
'paladin' => 'Paladin',
|
||||
'hunter' => 'Hunter',
|
||||
'mage' => 'Mage',
|
||||
'warlock' => 'Warlock',
|
||||
'shaman' => 'Shaman',
|
||||
'druid' => 'Druid',
|
||||
'priest' => 'Priest'
|
||||
];
|
||||
}
|
||||
28
app/View/Components/Layout.php
Normal file
28
app/View/Components/Layout.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Layout extends Component
|
||||
{
|
||||
/**
|
||||
* Layout name
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name = 'app')
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view("layouts.{$this->name}");
|
||||
}
|
||||
}
|
||||
|
|
@ -6,11 +6,13 @@
|
|||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"blade-ui-kit/blade-heroicons": "^1.2",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"laravel/framework": "^8.54",
|
||||
"laravel/tinker": "^2.5",
|
||||
"livewire/livewire": "^2.5",
|
||||
"pnx/laravel-ignite": "dev-master",
|
||||
"vinkla/hashids": "^9.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
@ -22,6 +24,12 @@
|
|||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.3.3"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/pnx/laravel-ignite"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
|
|
|
|||
205
composer.lock
generated
205
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6d2513918caf2a8560710d583f142529",
|
||||
"content-hash": "78c4a9878ac3ea63b726daad902f8225",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
|
@ -62,6 +62,156 @@
|
|||
},
|
||||
"time": "2021-03-11T06:42:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "blade-ui-kit/blade-heroicons",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/blade-ui-kit/blade-heroicons.git",
|
||||
"reference": "99d82616a72e36492edc9b95c6a2112d8632e9a7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/blade-ui-kit/blade-heroicons/zipball/99d82616a72e36492edc9b95c6a2112d8632e9a7",
|
||||
"reference": "99d82616a72e36492edc9b95c6a2112d8632e9a7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"blade-ui-kit/blade-icons": "^1.0",
|
||||
"illuminate/support": "^8.0",
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.0",
|
||||
"phpunit/phpunit": "^9.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"BladeUI\\Heroicons\\BladeHeroiconsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"BladeUI\\Heroicons\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dries Vints",
|
||||
"homepage": "https://driesvints.com"
|
||||
}
|
||||
],
|
||||
"description": "A package to easily make use of Heroicons in your Laravel Blade views.",
|
||||
"homepage": "https://github.com/blade-ui-kit/blade-heroicons",
|
||||
"keywords": [
|
||||
"Heroicons",
|
||||
"blade",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/blade-ui-kit/blade-heroicons/issues",
|
||||
"source": "https://github.com/blade-ui-kit/blade-heroicons/tree/1.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/caneco",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/driesvints",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-05T14:59:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "blade-ui-kit/blade-icons",
|
||||
"version": "1.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/blade-ui-kit/blade-icons.git",
|
||||
"reference": "548869bc820a25f803530c82028482aefe08115f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/blade-ui-kit/blade-icons/zipball/548869bc820a25f803530c82028482aefe08115f",
|
||||
"reference": "548869bc820a25f803530c82028482aefe08115f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^8.0",
|
||||
"illuminate/filesystem": "^8.0",
|
||||
"illuminate/support": "^8.0",
|
||||
"illuminate/view": "^8.0",
|
||||
"php": "^7.4|^8.0",
|
||||
"symfony/console": "^5.3",
|
||||
"symfony/finder": "^5.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3",
|
||||
"orchestra/testbench": "^6.0",
|
||||
"phpunit/phpunit": "^9.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/blade-icons-generate"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"BladeUI\\Icons\\BladeIconsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"BladeUI\\Icons\\": "src"
|
||||
},
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dries Vints",
|
||||
"homepage": "https://driesvints.com"
|
||||
}
|
||||
],
|
||||
"description": "A package to easily make use of icons in your Laravel Blade views.",
|
||||
"homepage": "https://github.com/blade-ui-kit/blade-icons",
|
||||
"keywords": [
|
||||
"blade",
|
||||
"icons",
|
||||
"laravel",
|
||||
"svg"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/blade-ui-kit/blade-icons/issues",
|
||||
"source": "https://github.com/blade-ui-kit/blade-icons"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/caneco",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/driesvints",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-08-11T10:09:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brick/math",
|
||||
"version": "0.9.3",
|
||||
|
|
@ -2323,6 +2473,55 @@
|
|||
],
|
||||
"time": "2021-08-28T21:27:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pnx/laravel-ignite",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pnx/laravel-ignite.git",
|
||||
"reference": "a40324f96ad834321c434cef24a95423b77d14eb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pnx/laravel-ignite/zipball/a40324f96ad834321c434cef24a95423b77d14eb",
|
||||
"reference": "a40324f96ad834321c434cef24a95423b77d14eb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3"
|
||||
},
|
||||
"suggest": {
|
||||
"blade-ui-kit/blade-icons": "For adding icons to form elements."
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Ignite\\FormServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ignite\\": "src"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Henrik Hautakoski",
|
||||
"email": "henrik.hautakoski@gmail.com"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/pnx/laravel-ignite/tree/master",
|
||||
"issues": "https://github.com/pnx/laravel-ignite/issues"
|
||||
},
|
||||
"time": "2022-01-02T12:50:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "1.1.1",
|
||||
|
|
@ -8361,7 +8560,9 @@
|
|||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"pnx/laravel-ignite": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ return [
|
|||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
'guard' => 'admin',
|
||||
'passwords' => 'admins',
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -36,9 +36,9 @@ return [
|
|||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'admin' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
'provider' => 'admins',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
@ -60,15 +60,10 @@ return [
|
|||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'admins' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
'model' => App\Models\Admin::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -87,8 +82,8 @@ return [
|
|||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'admins' => [
|
||||
'provider' => 'admins',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
|
|
|
|||
9
config/ignite.php
Normal file
9
config/ignite.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'select' => [
|
||||
'icon' => 'heroicon-s-chevron-down',
|
||||
]
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAdminsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('admins', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('username')->unique();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'failed' => 'Invalid username and/or password',
|
||||
'password' => 'The provided password is incorrect.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"Name": "Namn",
|
||||
"Loading": "Laddar",
|
||||
"Save": "Spara",
|
||||
"New": "Ny",
|
||||
"Back": "Tillbaka",
|
||||
"Somebody" : "Någon",
|
||||
"Create shareable URL": "Skapa en delbar URL",
|
||||
"Sharable URL": "Delbar URL",
|
||||
|
|
@ -10,12 +13,42 @@
|
|||
"Go again?" : "Köra igen?",
|
||||
"Game over!" : "Spelet slut!",
|
||||
"Winning rows": "Vinstrader",
|
||||
"Class": "Klass",
|
||||
"Classes" : "Klasser",
|
||||
"Character": "Karaktär",
|
||||
"Characters" : "Karaktärer",
|
||||
"Card": "Kort",
|
||||
"Cards": "Kort",
|
||||
|
||||
"singular_somebody" : "Någon",
|
||||
|
||||
"plurar_somebody" : "Några",
|
||||
"plurar_tank": "Tanken",
|
||||
"plurar_paladin" : "Paladinen"
|
||||
"plurar_paladin" : "Paladinen",
|
||||
|
||||
"Actions": "Åtgärd",
|
||||
|
||||
"Create card": "Skapa kort",
|
||||
"Edit card": "Ändra kort",
|
||||
"Card was successfully created.": "Kortet har lagts till.",
|
||||
"Card was successfully updated.": "Kortet har uppdaterats.",
|
||||
"Card #:id was deleted.": "Kort #:id togs bort.",
|
||||
|
||||
"Create character": "Skapa karaktär",
|
||||
"Edit character": "Ändra karaktär",
|
||||
"Character was successfully created.": "Karaktären har lagts till.",
|
||||
"Character was successfully updated.": "Karaktären har uppdaterats.",
|
||||
"Character #:id was deleted.": "Karaktär #:id togs bort.",
|
||||
|
||||
"Create raid": "Skapa raid",
|
||||
"Edit raid": "Ändra raid",
|
||||
"Raid was successfully created.": "Raiden har lagts till.",
|
||||
"Raid was successfully updated.": "Raiden har uppdaterats.",
|
||||
"Raid #:id was deleted.": "Raid #:id togs bort.",
|
||||
|
||||
"Select a character": "Välj en karaktär",
|
||||
"Select a class": "Välj en klass",
|
||||
"Select a raid": "Välj en raid",
|
||||
|
||||
"Logout": "Logga ut"
|
||||
}
|
||||
|
|
|
|||
18
resources/lang/se/auth.php
Normal file
18
resources/lang/se/auth.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used during authentication for various
|
||||
| messages that we need to display to the user. You are free to modify
|
||||
| these language lines according to your application's requirements.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'failed' => 'Ogiltigt användarnamn ock/eller lösenord',
|
||||
'password' => 'Lösenordet är felaktigt',
|
||||
'throttle' => 'För många inloggningsförsök. Var vänlig försök igen om :seconds sekunder.',
|
||||
];
|
||||
17
resources/lang/se/pagination.php
Normal file
17
resources/lang/se/pagination.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used by the paginator library to build
|
||||
| the simple pagination links. You are free to change them to anything
|
||||
| you want to customize your views to better match your application.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'next' => 'Nästa »',
|
||||
'previous' => '« Föregående',
|
||||
];
|
||||
20
resources/lang/se/passwords.php
Normal file
20
resources/lang/se/passwords.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are the default lines which match reasons
|
||||
| that are given by the password broker for a password update attempt
|
||||
| has failed, such as for an invalid token or invalid new password.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'reset' => 'Lösenordet har blivit återställt!',
|
||||
'sent' => 'Lösenordspåminnelse skickad!',
|
||||
'throttled' => 'Vänligen vänta innan du försöker igen.',
|
||||
'token' => 'Koden för lösenordsåterställning är ogiltig.',
|
||||
'user' => 'Det finns ingen användare med den e-postadressen.',
|
||||
];
|
||||
160
resources/lang/se/validation.php
Normal file
160
resources/lang/se/validation.php
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'accepted' => ':Attribute måste accepteras.',
|
||||
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
|
||||
'active_url' => ':Attribute är inte en giltig webbadress.',
|
||||
'after' => ':Attribute måste vara ett datum efter :date.',
|
||||
'after_or_equal' => ':Attribute måste vara ett datum senare eller samma dag som :date.',
|
||||
'alpha' => ':Attribute får endast innehålla bokstäver.',
|
||||
'alpha_dash' => ':Attribute får endast innehålla bokstäver, siffror och bindestreck.',
|
||||
'alpha_num' => ':Attribute får endast innehålla bokstäver och siffror.',
|
||||
'array' => ':Attribute måste vara en array.',
|
||||
'attached' => 'Denna :attribute är redan bifogad.',
|
||||
'before' => ':Attribute måste vara ett datum innan :date.',
|
||||
'before_or_equal' => ':Attribute måste vara ett datum före eller samma dag som :date.',
|
||||
'between' => [
|
||||
'array' => ':Attribute måste innehålla mellan :min - :max objekt.',
|
||||
'file' => ':Attribute måste vara mellan :min till :max kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara en siffra mellan :min och :max.',
|
||||
'string' => ':Attribute måste innehålla :min till :max tecken.',
|
||||
],
|
||||
'boolean' => ':Attribute måste vara sant eller falskt.',
|
||||
'confirmed' => ':Attribute bekräftelsen matchar inte.',
|
||||
'current_password' => 'The password is incorrect.',
|
||||
'date' => ':Attribute är inte ett giltigt datum.',
|
||||
'date_equals' => ':Attribute måste vara ett datum lika med :date.',
|
||||
'date_format' => ':Attribute matchar inte formatet :format.',
|
||||
'declined' => 'The :attribute must be declined.',
|
||||
'declined_if' => 'The :attribute must be declined when :other is :value.',
|
||||
'different' => ':Attribute och :other får inte vara lika.',
|
||||
'digits' => ':Attribute måste vara :digits tecken.',
|
||||
'digits_between' => ':Attribute måste vara mellan :min och :max tecken.',
|
||||
'dimensions' => ':Attribute har felaktiga bilddimensioner.',
|
||||
'distinct' => ':Attribute innehåller fler än en repetition av samma element.',
|
||||
'email' => ':Attribute måste innehålla en korrekt e-postadress.',
|
||||
'ends_with' => ':Attribute måste sluta med en av följande: :values.',
|
||||
'exists' => ':Attribute är ogiltigt.',
|
||||
'file' => ':Attribute måste vara en fil.',
|
||||
'filled' => ':Attribute är obligatoriskt.',
|
||||
'gt' => [
|
||||
'array' => ':Attribute måste innehålla fler än :value objekt.',
|
||||
'file' => ':Attribute måste vara större än :value kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara större än :value.',
|
||||
'string' => ':Attribute måste vara längre än :value tecken.',
|
||||
],
|
||||
'gte' => [
|
||||
'array' => ':Attribute måste innehålla lika många eller fler än :value objekt.',
|
||||
'file' => ':Attribute måste vara lika med eller större än :value kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara lika med eller större än :value.',
|
||||
'string' => ':Attribute måste vara lika med eller längre än :value tecken.',
|
||||
],
|
||||
'image' => ':Attribute måste vara en bild.',
|
||||
'in' => ':Attribute är ogiltigt.',
|
||||
'in_array' => ':Attribute finns inte i :other.',
|
||||
'integer' => ':Attribute måste vara en siffra.',
|
||||
'ip' => ':Attribute måste vara en giltig IP-adress.',
|
||||
'ipv4' => ':Attribute måste vara en giltig IPv4-adress.',
|
||||
'ipv6' => ':Attribute måste vara en giltig IPv6-adress.',
|
||||
'json' => ':Attribute måste vara en giltig JSON-sträng.',
|
||||
'lt' => [
|
||||
'array' => ':Attribute måste innehålla färre än :value objekt.',
|
||||
'file' => ':Attribute måste vara mindre än :value kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara mindre än :value.',
|
||||
'string' => ':Attribute måste vara kortare än :value tecken.',
|
||||
],
|
||||
'lte' => [
|
||||
'array' => ':Attribute måste innehålla lika många eller färre än :value objekt.',
|
||||
'file' => ':Attribute måste vara lika med eller mindre än :value kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara lika med eller mindre än :value.',
|
||||
'string' => ':Attribute måste vara lika med eller kortare än :value tecken.',
|
||||
],
|
||||
'max' => [
|
||||
'array' => ':Attribute får inte innehålla mer än :max objekt.',
|
||||
'file' => ':Attribute får max vara :max kilobyte stor.',
|
||||
'numeric' => ':Attribute får inte vara större än :max.',
|
||||
'string' => ':Attribute får max innehålla :max tecken.',
|
||||
],
|
||||
'mimes' => ':Attribute måste vara en fil av typen: :values.',
|
||||
'mimetypes' => ':Attribute måste vara en fil av typen: :values.',
|
||||
'min' => [
|
||||
'array' => ':Attribute måste innehålla minst :min objekt.',
|
||||
'file' => ':Attribute måste vara minst :min kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara större än :min.',
|
||||
'string' => ':Attribute måste innehålla minst :min tecken.',
|
||||
],
|
||||
'multiple_of' => ':attribute måste vara en multipel av :value',
|
||||
'not_in' => ':Attribute är ogiltigt.',
|
||||
'not_regex' => 'Formatet för :attribute är ogiltigt.',
|
||||
'numeric' => ':Attribute måste vara en siffra.',
|
||||
'password' => 'Lösenordet är fel.',
|
||||
'present' => ':Attribute måste finnas med.',
|
||||
'prohibited' => 'Fältet :attribute är förbjudet.',
|
||||
'prohibited_if' => ':attribute är förbjudet när :other är :value.',
|
||||
'prohibited_unless' => ':attribute är förbjudet om inte :other är :values.',
|
||||
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||
'regex' => ':Attribute har ogiltigt format.',
|
||||
'relatable' => 'Denna :attribute kanske inte är associerad med den här resursen.',
|
||||
'required' => ':Attribute är obligatoriskt.',
|
||||
'required_if' => ':Attribute är obligatoriskt när :other är :value.',
|
||||
'required_unless' => ':Attribute är obligatoriskt när inte :other finns bland :values.',
|
||||
'required_with' => ':Attribute är obligatoriskt när :values är ifyllt.',
|
||||
'required_with_all' => ':Attribute är obligatoriskt när :values är ifyllt.',
|
||||
'required_without' => ':Attribute är obligatoriskt när :values ej är ifyllt.',
|
||||
'required_without_all' => ':Attribute är obligatoriskt när ingen av :values är ifyllt.',
|
||||
'same' => ':Attribute och :other måste vara lika.',
|
||||
'size' => [
|
||||
'array' => ':Attribute måste innehålla :size objekt.',
|
||||
'file' => ':Attribute får endast vara :size kilobyte stor.',
|
||||
'numeric' => ':Attribute måste vara :size.',
|
||||
'string' => ':Attribute måste innehålla :size tecken.',
|
||||
],
|
||||
'starts_with' => ':Attribute måste börja med en av följande: :values',
|
||||
'string' => ':Attribute måste vara en sträng.',
|
||||
'timezone' => ':Attribute måste vara en giltig tidszon.',
|
||||
'unique' => ':Attribute används redan.',
|
||||
'uploaded' => ':Attribute kunde inte laddas upp.',
|
||||
'url' => ':Attribute har ett ogiltigt format.',
|
||||
'uuid' => ':Attribute måste vara ett giltigt UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
//'attribute-name' => [
|
||||
// 'rule-name' => 'custom-message',
|
||||
//],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
];
|
||||
20
resources/views/admin/admin/index.blade.php
Normal file
20
resources/views/admin/admin/index.blade.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<x-layout name="admin">
|
||||
|
||||
@livewire('datatable', [
|
||||
'model' => \App\Models\Admin::class,
|
||||
'default_sort' => 'id',
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'username' => 'Username',
|
||||
'created_at' => 'Created',
|
||||
'updated_at' => 'Updated',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'created_at' => 'created_at',
|
||||
'updated_at' => 'updated_at'
|
||||
]
|
||||
])
|
||||
|
||||
</x-layout>
|
||||
25
resources/views/admin/card/index.blade.php
Normal file
25
resources/views/admin/card/index.blade.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<x-layout name="admin">
|
||||
|
||||
<div class="mb-4">
|
||||
<x-button href="{{ route('admin.card.create') }}" type="info">{{ __('New') }}</x-button>
|
||||
</div>
|
||||
|
||||
@livewire('datatable', [
|
||||
'model' => \App\Models\Card::class,
|
||||
'default_sort' => 'id',
|
||||
'route_edit' => 'admin.card.edit',
|
||||
'route_delete' => 'admin.card.delete',
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'body' => 'Body',
|
||||
'subject' => 'Subject',
|
||||
'subject_type' => 'Subject Type',
|
||||
'raid.name' => 'Raid',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'body' => 'body',
|
||||
]
|
||||
])
|
||||
|
||||
</x-layout>
|
||||
22
resources/views/admin/character/index.blade.php
Normal file
22
resources/views/admin/character/index.blade.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<x-layout name="admin">
|
||||
|
||||
<div class="mb-4">
|
||||
<x-button href="{{ route('admin.character.create') }}" type="info">{{ __('New') }}</x-button>
|
||||
</div>
|
||||
|
||||
@livewire('datatable', [
|
||||
'model' => \App\Models\Character::class,
|
||||
'default_sort' => 'id',
|
||||
'route_edit' => 'admin.character.edit',
|
||||
'route_delete' => 'admin.character.delete',
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'name' => 'Name',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
]
|
||||
])
|
||||
|
||||
</x-layout>
|
||||
22
resources/views/admin/raid/index.blade.php
Normal file
22
resources/views/admin/raid/index.blade.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<x-layout name="admin">
|
||||
|
||||
<div class="mb-4">
|
||||
<x-button href="{{ route('admin.raid.create') }}" type="info">{{ __('New') }}</x-button>
|
||||
</div>
|
||||
|
||||
@livewire('datatable', [
|
||||
'model' => \App\Models\Raid::class,
|
||||
'default_sort' => 'id',
|
||||
'route_edit' => 'admin.raid.edit',
|
||||
'route_delete' => 'admin.raid.delete',
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'name' => 'Name',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
]
|
||||
])
|
||||
|
||||
</x-layout>
|
||||
3
resources/views/auth/login.blade.php
Normal file
3
resources/views/auth/login.blade.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<x-layout name="auth">
|
||||
@livewire('form.login-form')
|
||||
</x-layout>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
@props(['href' => false, 'type' => 'default'])
|
||||
@props(['href' => false, 'type' => 'default', 'element' => false])
|
||||
|
||||
@php
|
||||
|
||||
|
|
@ -22,6 +22,8 @@ default:
|
|||
if ($href) {
|
||||
$element = 'a';
|
||||
$attributes = $attributes->merge([ 'href' => $href ]);
|
||||
} else if ($element == 'input') {
|
||||
$attributes = $attributes->merge([ 'type' => 'submit' ]);
|
||||
} else {
|
||||
$element = 'button';
|
||||
}
|
||||
|
|
|
|||
1
resources/views/components/header.blade.php
Normal file
1
resources/views/components/header.blade.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h2 {!! $attributes->merge(["class" => "text-2xl"]) !!}>{{ $slot }}</h2>
|
||||
27
resources/views/components/notification.blade.php
Normal file
27
resources/views/components/notification.blade.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
@props(['variant' => 'info', 'delay' => 2000])
|
||||
@php
|
||||
|
||||
switch($variant) {
|
||||
case 'success':
|
||||
$variant_classes = 'text-green-800 bg-green-200 border-green-300';
|
||||
break;
|
||||
case 'warning':
|
||||
$variant_classes = 'text-yellow-800 bg-yellow-200 border-yellow-300';
|
||||
break;
|
||||
case 'danger':
|
||||
$variant_classes = 'text-red-800 bg-red-200 border-red-300';
|
||||
break;
|
||||
case 'info':
|
||||
default:
|
||||
$variant_classes = 'text-blue-800 bg-blue-200 border-blue-300';
|
||||
}
|
||||
|
||||
@endphp
|
||||
|
||||
<div x-data="{ show: true }"
|
||||
x-show="show"
|
||||
x-init="setTimeout(() => show = false, {{ $delay }})"
|
||||
{!! $attributes->merge(['class' => "w-full px-4 py-2 rounded border $variant_classes"]) !!}>
|
||||
|
||||
{{ $slot }}
|
||||
</div>
|
||||
5
resources/views/components/sort-link.blade.php
Normal file
5
resources/views/components/sort-link.blade.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@props(['name', 'column', 'dir'])
|
||||
|
||||
@if ($name === $column)
|
||||
<x-icon name="{{ $dir == 'asc' ? 'heroicon-s-sort-ascending' : 'heroicon-s-sort-descending' }}" {{ $attributes->only('class') }} />
|
||||
@endif
|
||||
32
resources/views/form/card.blade.php
Normal file
32
resources/views/form/card.blade.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
<div class="space-y-4">
|
||||
|
||||
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' card') }}</x-header>
|
||||
|
||||
<form class="space-y-4" wire:submit.prevent="submit">
|
||||
|
||||
<div>
|
||||
<x-ignite-label for="record.body">{{ __('Body') }}</x-ignite-label>
|
||||
<x-ignite-input name="record.body" wire:model="record.body" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-3 space-x-4">
|
||||
<div>
|
||||
<x-ignite-label for="record.raid_id">{{ __('Raid') }}</x-ignite-label>
|
||||
<x-ignite-select name="record.raid_id" wire:model="record.raid_id" :options="$raids" placeholder="{{ __('Select a raid') }}" />
|
||||
</div>
|
||||
<div>
|
||||
<x-ignite-label for="record.character_id">{{ __('Character') }}</x-ignite-label>
|
||||
<x-ignite-select name="record.character_id" wire:model="record.character_id" :options="$characters" placeholder="{{ __('Select a character') }}" />
|
||||
</div>
|
||||
<div>
|
||||
<x-ignite-label for="record.class">{{ __('Class') }}</x-ignite-label>
|
||||
<x-ignite-select name="record.class" wire:model="record.class" :options="$classes" placeholder="{{ __('Select a class') }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-button type="info">{{ __('Save') }}</x-button>
|
||||
<x-button href="{{ route('admin.card.index') }}" type="warning">{{ __('Back') }}</x-button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
17
resources/views/form/character.blade.php
Normal file
17
resources/views/form/character.blade.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
<div class="space-y-4">
|
||||
|
||||
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' character') }}</x-header>
|
||||
|
||||
<form class="space-y-4" wire:submit.prevent="submit">
|
||||
|
||||
<div>
|
||||
<x-ignite-label for="record.name">{{ __('Name') }}</x-ignite-label>
|
||||
<x-ignite-input name="record.name" wire:model="record.name" />
|
||||
</div>
|
||||
|
||||
<x-button type="info">{{ __('Save') }}</x-button>
|
||||
<x-button href="{{ route('admin.character.index') }}" type="warning">{{ __('Back') }}</x-button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
17
resources/views/form/login.blade.php
Normal file
17
resources/views/form/login.blade.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<form class="space-y-4" wire:submit.prevent="submit">
|
||||
@if (Session::has('message'))
|
||||
<p class="text-center text-red-400">{{ Session::get('message') }}</p>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<x-ignite-label class="sr-only" for="username">Username</x-ignite-label>
|
||||
<x-ignite-input name="username" wire:model="username" placeholder="Username" class="" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="sr-only" for="password">Password</label>
|
||||
<x-ignite-input name="password" wire:model="password" type="password" placeholder="Password" />
|
||||
</div>
|
||||
|
||||
<x-button element="input" wire:click="submit" class="w-full" type="info" value="Login" />
|
||||
</form>
|
||||
17
resources/views/form/raid.blade.php
Normal file
17
resources/views/form/raid.blade.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
<div class="space-y-4">
|
||||
|
||||
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' raid') }}</x-header>
|
||||
|
||||
<form class="space-y-4" wire:submit.prevent="submit">
|
||||
|
||||
<div>
|
||||
<x-ignite-label for="record.name">{{ __('Name') }}</x-ignite-label>
|
||||
<x-ignite-input name="record.name" wire:model="record.name" />
|
||||
</div>
|
||||
|
||||
<x-button type="info">{{ __('Save') }}</x-button>
|
||||
<x-button href="{{ route('admin.raid.index') }}" type="warning">{{ __('Back') }}</x-button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
37
resources/views/layouts/admin.blade.php
Normal file
37
resources/views/layouts/admin.blade.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
@php
|
||||
$item_classes = "flex items-center inline-block w-full px-4 py-2 rounded-lg hover:bg-blue-800";
|
||||
@endphp
|
||||
|
||||
<x-layout>
|
||||
<div class="flex min-h-screen">
|
||||
|
||||
<div class="bg-gray-800 w-2/12 px-4 divide-y divide-gray-600">
|
||||
|
||||
<ul class="py-4 space-y-2 text-white">
|
||||
<li><a class="{{ $item_classes }}" href="{{ url('/admin') }}"><x-heroicon-o-user-group class="h-8 mr-2"/> {{ __('Admins') }}</a></li>
|
||||
</ul>
|
||||
|
||||
<ul class="py-4 space-y-2 text-white">
|
||||
<li><a class="{{ $item_classes }}" href="{{ url('/admin/cards') }}"><x-heroicon-o-collection class="h-8 mr-2"/> {{ __('Cards') }}</a></li>
|
||||
<li><a class="{{ $item_classes }}" href="{{ url('/admin/characters') }}"><x-heroicon-o-identification class="h-8 mr-2"/> {{ __('Characters') }}</a></li>
|
||||
<li><a class="{{ $item_classes }}" href="{{ url('/admin/raids') }}"><x-heroicon-o-globe class="h-8 mr-2"/> {{ __('Raids') }}</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="py-4 space-y-2 text-white">
|
||||
<x-ignite-form action="{{ url('/admin/logout') }}">
|
||||
<li>
|
||||
<a class="{{ $item_classes }}" href="#" onclick="event.preventDefault();this.closest('form').submit();">
|
||||
<x-heroicon-o-logout class="h-8 mr-2"/> {{ __('Logout') }}
|
||||
</a>
|
||||
</li>
|
||||
</x-ignite-form>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="w-10/12 m-8">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</x-layout>
|
||||
|
|
@ -6,11 +6,15 @@
|
|||
<title>Bingo!</title>
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
@livewireStyles
|
||||
<script defer src="https://unpkg.com/alpinejs@3.2.4/dist/cdn.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body class="h-full">
|
||||
|
||||
<livewire:alert-container />
|
||||
|
||||
{{ $slot }}
|
||||
|
||||
@livewireScripts
|
||||
@igniteScripts
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
5
resources/views/layouts/auth.blade.php
Normal file
5
resources/views/layouts/auth.blade.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<x-layout>
|
||||
<div class="w-96 mx-auto mt-28 p-4 bg-blue-100 border border-blue-200 rounded">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</x-layout>
|
||||
5
resources/views/livewire/alert-container.blade.php
Normal file
5
resources/views/livewire/alert-container.blade.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="absolute z-50 top-0 w-full px-4 sm:px-8 space-y-2 mt-2">
|
||||
@foreach($messages as $message)
|
||||
<x-notification variant="{{ $message[0] }}">{{ $message[1] }}</x-notification>
|
||||
@endforeach
|
||||
</div>
|
||||
59
resources/views/livewire/datatable.blade.php
Normal file
59
resources/views/livewire/datatable.blade.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<div>
|
||||
|
||||
<table class="table-auto w-full">
|
||||
|
||||
<tr class="text-left border-b-2">
|
||||
@foreach($columns as $key => $name)
|
||||
<th class="border px-6 py-3 w-24">
|
||||
@if (isset($sort_columns[$key]))
|
||||
<div class="flex items-center justify-between cursor-pointer" wire:click="sort('{{ $key }}')">
|
||||
<span class="hover:underline">{{ __($name) }}</span>
|
||||
<x-sort-link name="{{ $key }}" :column="$sort" :dir="$dir" class="ml-2 text-gray-600 h-5" />
|
||||
</div>
|
||||
@else
|
||||
{{ $name }}
|
||||
@endif
|
||||
</th>
|
||||
@endforeach
|
||||
|
||||
@if($route_delete || $route_edit)
|
||||
<th class="border px-6 py-3 w-4">{{ __('Actions') }}</th>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
<tbody>
|
||||
@foreach($items as $item)
|
||||
<tr class="odd:bg-gray-50">
|
||||
@foreach(array_keys($columns) as $key)
|
||||
<td class="border px-4 py-2">{{ Arr::get($item, $key) }}</td>
|
||||
@endforeach
|
||||
|
||||
@if ($route_edit || $route_delete)
|
||||
<td class="border px-4 py-2">
|
||||
@if($route_edit)
|
||||
<a href="{{ route($route_edit, [ $item ]) }}">
|
||||
<x-icon name="heroicon-o-pencil" class="inline-block w-6 text-yellow-500"/>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if($route_delete)
|
||||
<x-ignite-form class="inline-block" id="dt-delete-{{$_instance->id}}-{{ $item->id }}" method="DELETE" action="{{ route($route_delete, [ $item ]) }}">
|
||||
<a href="javascript:document.getElementById('dt-delete-{{$_instance->id}}-{{ $item->id }}').submit();">
|
||||
<x-icon name="heroicon-o-trash" class="inline-block w-6 text-red-500"/>
|
||||
</a>
|
||||
</x-ignite-form>
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if ($items->hasPages())
|
||||
<div class="mt-4">
|
||||
{{ $items->links() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
|
@ -5,6 +5,12 @@ use Illuminate\Support\Facades\Route;
|
|||
use App\Http\Livewire\Game;
|
||||
use App\Http\Livewire\Setup;
|
||||
use App\Http\Controllers\SettingController;
|
||||
use App\Http\Controllers\AuthController;
|
||||
|
||||
use App\Http\Controllers\Admin\AdminController;
|
||||
use App\Http\Controllers\Admin\CardController;
|
||||
use App\Http\Controllers\Admin\CharacterController;
|
||||
use App\Http\Controllers\Admin\RaidController;
|
||||
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
|
|
@ -28,3 +34,33 @@ Route::get('/setup', Setup::class)->name('setup');
|
|||
route::get('/setup/{setting}', [ SettingController::class, "hash" ])->name('setup-hash');
|
||||
|
||||
Route::get('/game', Game::class)->name('game');
|
||||
|
||||
// Admin section
|
||||
Route::prefix('admin')->group(function() {
|
||||
|
||||
// Auth
|
||||
Route::get('/login', [AuthController::class, 'create'])->name('login');
|
||||
Route::post('/login', [AuthController::class, 'store']);
|
||||
|
||||
Route::middleware(['auth'])->group(function() {
|
||||
|
||||
Route::get('/', [AdminController::class, 'index']);
|
||||
|
||||
Route::get('/cards', [CardController::class, 'index'])->name('admin.card.index');
|
||||
Route::get('/cards/new', CardController::getForm())->name('admin.card.create');
|
||||
Route::get('/cards/{card}', CardController::getForm())->name('admin.card.edit');
|
||||
Route::delete('/cards/{card}', [CardController::class, 'destroy'])->name('admin.card.delete');
|
||||
|
||||
Route::get('/characters', [CharacterController::class, 'index'])->name('admin.character.index');
|
||||
Route::get('/characters/new', CharacterController::getForm())->name('admin.character.create');
|
||||
Route::get('/characters/{character}', CharacterController::getForm())->name('admin.character.edit');
|
||||
Route::delete('/characters/{character}', [CharacterController::class, 'destroy'])->name('admin.character.delete');
|
||||
|
||||
Route::get('/raids', [RaidController::class, 'index'])->name('admin.raid.index');
|
||||
Route::get('/raids/new', RaidController::getForm())->name('admin.raid.create');
|
||||
Route::get('/raids/{raid}', RaidController::getForm())->name('admin.raid.edit');
|
||||
Route::delete('/raids/{raid}', [RaidController::class, 'destroy'])->name('admin.raid.delete');
|
||||
|
||||
Route::post('/logout', [AuthController::class, 'destroy'])->name('logout');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
4
tailwind.config.js
vendored
4
tailwind.config.js
vendored
|
|
@ -24,7 +24,9 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
extend: {
|
||||
backgroundColor: ['odd'],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
plugin(function({ addUtilities }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue