owned index
This commit is contained in:
parent
259ebe827c
commit
ee075c543e
13 changed files with 100 additions and 71 deletions
|
@ -15,7 +15,7 @@ class OwnedController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view('admin.owned.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,62 +25,50 @@ public function index()
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreOwnedRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreOwnedRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Owned $owned
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Owned $owned)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Owned $owned
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Owned $owned)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateOwnedRequest $request
|
||||
* @param \App\Models\Owned $owned
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateOwnedRequest $request, Owned $owned)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Owned $owned
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Owned $owned)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,24 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class Collective extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, Notifiable;
|
||||
use HasApiTokens;
|
||||
use Notifiable;
|
||||
|
||||
/* @var array<int, string> */
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
|
||||
/* @var array<int, string> */
|
||||
|
||||
protected $hidden = [
|
||||
|
@ -33,33 +34,38 @@ class Collective extends Authenticatable
|
|||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
/* --------------------------------------------------------------------------- relationships ---- */
|
||||
/* ----------------------------------------------------------------------- relationships ---- */
|
||||
|
||||
public function joined()
|
||||
{
|
||||
return $this->hasMany(Joined::class);
|
||||
}
|
||||
public function joined() : HasMany
|
||||
{
|
||||
return $this->hasMany(Joined::class);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------------- password ---- */
|
||||
public function owned() : HasMany
|
||||
{
|
||||
return $this->hasMany(Owned::class);
|
||||
}
|
||||
|
||||
protected function password() : Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn ($value) => bcrypt($value),
|
||||
);
|
||||
}
|
||||
/* ---------------------------------------------------------------------------- password ---- */
|
||||
|
||||
/* ----------------------------------------------------------------------------------- store ---- */
|
||||
protected function password() : Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn ($value) => bcrypt($value),
|
||||
);
|
||||
}
|
||||
|
||||
public static function store(array $validated) : Collective
|
||||
{
|
||||
$collective = new Collective();
|
||||
$collective->title = $validated['title'];
|
||||
$collective->name = $validated['name'];
|
||||
$collective->email = $validated['email'];
|
||||
$collective->password = $validated['password'];
|
||||
$collective->save();
|
||||
/* ------------------------------------------------------------------------------- store ---- */
|
||||
|
||||
return $collective;
|
||||
}
|
||||
public static function store(array $validated) : Collective
|
||||
{
|
||||
$collective = new Collective();
|
||||
$collective->title = $validated['title'];
|
||||
$collective->name = $validated['name'];
|
||||
$collective->email = $validated['email'];
|
||||
$collective->password = $validated['password'];
|
||||
$collective->save();
|
||||
|
||||
return $collective;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use App\Traits\Categorizable;
|
||||
use App\Traits\Imageable;
|
||||
use App\Traits\Ownable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
@ -11,6 +12,7 @@
|
|||
class Joined extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Ownable;
|
||||
use Categorizable;
|
||||
use Imageable;
|
||||
|
||||
|
@ -29,10 +31,7 @@ class Joined extends Model
|
|||
|
||||
/* ----------------------------------------------------------------------- relationships ---- */
|
||||
|
||||
public function collective()
|
||||
{
|
||||
return $this->belongsTo(Collective::class);
|
||||
}
|
||||
// injected by trait: collective (belongsTo)
|
||||
|
||||
// injected by trait: categories (morph many-to-many)
|
||||
|
||||
|
|
|
@ -2,12 +2,20 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Categorizable;
|
||||
use App\Traits\Imageable;
|
||||
use App\Traits\Ownable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Owned extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Ownable;
|
||||
use Categorizable;
|
||||
use Imageable;
|
||||
|
||||
protected $table = 'owned';
|
||||
|
||||
/* ----------------------------------------------------------------------- relationships ---- */
|
||||
}
|
||||
|
|
13
app/Traits/Ownable.php
Normal file
13
app/Traits/Ownable.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
trait Ownable
|
||||
{
|
||||
public function collective() : BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Collective::class);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ public function definition()
|
|||
'status' => $statuses->random(),
|
||||
'slug' => $this->faker->slug(2, false),
|
||||
'title' => $this->faker->words(3, true),
|
||||
'image' => $this->faker->image(),
|
||||
'image' => $this->faker->imageUrl(),
|
||||
'hold_member_updates' => $this->faker->boolean(),
|
||||
'notify_pending' => $this->faker->boolean(),
|
||||
'sort_by' => 'country',
|
||||
|
|
|
@ -13,7 +13,7 @@ .form__input--file::-webkit-file-upload-button {
|
|||
-webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
}
|
||||
.pagination__item, .pagination__item--disabled, .pagination__item--active, .btn--table, .l-page-nav__link, .form__input--file::file-selector-button, .form__btn {
|
||||
.pagination__item, .pagination__item--disabled, .pagination__item--active, .btn--table, .l-page-nav__link, .form__input--file::file-selector-button, .input--btn {
|
||||
border: 1px solid #7874ff;
|
||||
padding: 5px 10px;
|
||||
margin-right: 5px;
|
||||
|
@ -32,7 +32,7 @@ .form__input--file:hover::-webkit-file-upload-button {
|
|||
-webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
}
|
||||
.pagination__item:hover, .pagination__item--disabled:hover, .pagination__item--active:hover, .btn--table:hover, .l-page-nav__link:hover, .form__input--file:hover::file-selector-button, .form__btn:hover {
|
||||
.pagination__item:hover, .pagination__item--disabled:hover, .pagination__item--active:hover, .btn--table:hover, .l-page-nav__link:hover, .form__input--file:hover::file-selector-button, .input--btn:hover {
|
||||
border-color: #de7cff;
|
||||
background-color: #f8e5ff;
|
||||
color: #de7cff;
|
||||
|
@ -45,7 +45,7 @@ .form__input--file:focus::-webkit-file-upload-button {
|
|||
-webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
|
||||
}
|
||||
.pagination__item:focus, .pagination__item--disabled:focus, .pagination__item--active:focus, .btn--table:focus, .l-page-nav__link:focus, .form__input--file:focus::file-selector-button, .form__btn:focus {
|
||||
.pagination__item:focus, .pagination__item--disabled:focus, .pagination__item--active:focus, .btn--table:focus, .l-page-nav__link:focus, .form__input--file:focus::file-selector-button, .input--btn:focus {
|
||||
border-color: #de7cff;
|
||||
background-color: #f8e5ff;
|
||||
color: #de7cff;
|
||||
|
|
|
@ -124,7 +124,7 @@ h1 {
|
|||
&:first-of-type { margin-top: 20px; }
|
||||
}
|
||||
|
||||
.form__btn {
|
||||
.input--btn {
|
||||
@extend %btn;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
<span class="l-nav__link">joined</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="l-nav__tab"><span class="l-nav__link">owned</span></a>
|
||||
<a href="{{ route('admin.owned.index') }}" class="l-nav__tab">
|
||||
<span class="l-nav__link">owned</span>
|
||||
</a>
|
||||
<a href="#" class="l-nav__tab"><span class="l-nav__link">collective</span></a>
|
||||
|
||||
<x-admin.form.destroy :btnClass="'l-nav__tab'" :object="auth_collective()"
|
||||
|
|
11
resources/views/admin/owned/index.blade.php
Normal file
11
resources/views/admin/owned/index.blade.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
@extends('admin.layout')
|
||||
|
||||
@section('pg-nav')
|
||||
<x-admin.nav :section="'owned'" />
|
||||
@endsection
|
||||
|
||||
@section('pg-title', 'Owned')
|
||||
|
||||
@section('content')
|
||||
<livewire:admin.list-fanlistings :class="'owned'" />
|
||||
@endsection
|
|
@ -24,8 +24,8 @@ class="form__input--checkbox">
|
|||
</div>
|
||||
|
||||
<div class="form__btns">
|
||||
<input type="submit" class="form__btn" value="Submit">
|
||||
<input type="reset" class="input__btn" value="Reset">
|
||||
<input type="submit" class="input--btn" value="Submit">
|
||||
<input type="reset" class="input--btn" value="Reset">
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
])
|
||||
|
||||
<div class="form__btns {{ $divClass }}">
|
||||
<input type="submit" class="form__btn {{ $submitClass }} {{ $btnClass }}"
|
||||
<input type="submit" class="input--btn {{ $submitClass }} {{ $btnClass }}"
|
||||
value="{{ $submitValue }}">
|
||||
<input type="reset" class="form__btn {{ $resetClass }} {{ $btnClass }}"
|
||||
<input type="reset" class="input--btn {{ $resetClass }} {{ $btnClass }}"
|
||||
value="{{ $resetValue }}">
|
||||
</div>
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use App\Http\Controllers\CollectiveController;
|
||||
use App\Http\Controllers\JoinedController;
|
||||
use App\Http\Controllers\OwnedController;
|
||||
use App\Http\Controllers\SessionsController;
|
||||
use App\Models\Owned;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|
@ -18,12 +20,9 @@
|
|||
Route::redirect('/fanatic', '/fanatic/login')->middleware('guest');
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('/fanatic/login', [SessionsController::class, 'create'])
|
||||
->name('admin.sessions.create');
|
||||
Route::get('/fanatic/install', [CollectiveController::class, 'create'])
|
||||
->name('admin.collectives.create');
|
||||
Route::post('/fanatic', [CollectiveController::class, 'store'])
|
||||
->name('admin.collectives.store');
|
||||
Route::get('/fanatic/login', [SessionsController::class, 'create'])->name('admin.sessions.create');
|
||||
Route::get('/fanatic/install', [CollectiveController::class, 'create'])->name('admin.collectives.create');
|
||||
Route::post('/fanatic', [CollectiveController::class, 'store'])->name('admin.collectives.store');
|
||||
});
|
||||
|
||||
Route::post('/fanatic', [SessionsController::class, 'store'])->name('admin.sessions.store');
|
||||
|
@ -32,16 +31,19 @@
|
|||
Route::get('/fanatic', [CollectiveController::class, 'dashboard'])->name('admin.dashboard');
|
||||
Route::delete('/fanatic', [SessionsController::class, 'destroy'])->name('admin.sessions.destroy');
|
||||
|
||||
Route::get('/fanatic/joined', [JoinedController::class, 'index'])
|
||||
->name('admin.joined.index');
|
||||
Route::get('/fanatic/joined/create', [JoinedController::class, 'create'])
|
||||
->name('admin.joined.create');
|
||||
Route::post('/fanatic/joined', [JoinedController::class, 'store'])
|
||||
->name('admin.joined.store');
|
||||
Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit'])
|
||||
->name('admin.joined.edit');
|
||||
Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update'])
|
||||
->name('admin.joined.update');
|
||||
Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy'])
|
||||
->name('admin.joined.destroy');
|
||||
// joined
|
||||
Route::get('/fanatic/joined', [JoinedController::class, 'index'])->name('admin.joined.index');
|
||||
Route::get('/fanatic/joined/create', [JoinedController::class, 'create'])->name('admin.joined.create');
|
||||
Route::post('/fanatic/joined', [JoinedController::class, 'store'])->name('admin.joined.store');
|
||||
Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit'])->name('admin.joined.edit');
|
||||
Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update'])->name('admin.joined.update');
|
||||
Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy'])->name('admin.joined.destroy');
|
||||
|
||||
// owned
|
||||
Route::get('/fanatic/owned', [OwnedController::class, 'index'])->name('admin.owned.index');
|
||||
Route::get('/fanatic/owned/create', [OwnedController::class, 'create'])->name('admin.owned.create');
|
||||
Route::post('/fanatic/owned', [OwnedController::class, 'store'])->name('admin.owned.store');
|
||||
Route::get('/fanatic/owned/{owned}/edit', [OwnedController::class, 'edit'])->name('admin.owned.edit');
|
||||
Route::patch('/fanatic/owned/{owned}', [OwnedController::class, 'update'])->name('admin.owned.update');
|
||||
Route::delete('/fanatic/owned/{owned}', [OwnedController::class, 'destroy'])->name('admin.owned.destroy');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue