owned index

This commit is contained in:
Marley Rae 2022-04-27 18:57:21 -07:00
parent 259ebe827c
commit ee075c543e
13 changed files with 100 additions and 71 deletions

View file

@ -15,7 +15,7 @@ class OwnedController extends Controller
*/ */
public function index() public function index()
{ {
// return view('admin.owned.index');
} }
/** /**
@ -25,62 +25,50 @@ public function index()
*/ */
public function create() public function create()
{ {
//
} }
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \App\Http\Requests\StoreOwnedRequest $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store(StoreOwnedRequest $request) public function store(StoreOwnedRequest $request)
{ {
//
} }
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param \App\Models\Owned $owned
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show(Owned $owned) public function show(Owned $owned)
{ {
//
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* *
* @param \App\Models\Owned $owned
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function edit(Owned $owned) public function edit(Owned $owned)
{ {
//
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \App\Http\Requests\UpdateOwnedRequest $request
* @param \App\Models\Owned $owned
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(UpdateOwnedRequest $request, Owned $owned) public function update(UpdateOwnedRequest $request, Owned $owned)
{ {
//
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param \App\Models\Owned $owned
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy(Owned $owned) public function destroy(Owned $owned)
{ {
//
} }
} }

View file

@ -3,13 +3,15 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\HasApiTokens;
class Collective extends Authenticatable class Collective extends Authenticatable
{ {
use HasApiTokens, Notifiable; use HasApiTokens;
use Notifiable;
/* @var array<int, string> */ /* @var array<int, string> */
@ -19,7 +21,6 @@ class Collective extends Authenticatable
'password', 'password',
]; ];
/* @var array<int, string> */ /* @var array<int, string> */
protected $hidden = [ protected $hidden = [
@ -33,14 +34,19 @@ class Collective extends Authenticatable
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
]; ];
/* --------------------------------------------------------------------------- relationships ---- */ /* ----------------------------------------------------------------------- relationships ---- */
public function joined() public function joined() : HasMany
{ {
return $this->hasMany(Joined::class); return $this->hasMany(Joined::class);
} }
/* -------------------------------------------------------------------------------- password ---- */ public function owned() : HasMany
{
return $this->hasMany(Owned::class);
}
/* ---------------------------------------------------------------------------- password ---- */
protected function password() : Attribute protected function password() : Attribute
{ {
@ -49,7 +55,7 @@ protected function password() : Attribute
); );
} }
/* ----------------------------------------------------------------------------------- store ---- */ /* ------------------------------------------------------------------------------- store ---- */
public static function store(array $validated) : Collective public static function store(array $validated) : Collective
{ {

View file

@ -4,6 +4,7 @@
use App\Traits\Categorizable; use App\Traits\Categorizable;
use App\Traits\Imageable; use App\Traits\Imageable;
use App\Traits\Ownable;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -11,6 +12,7 @@
class Joined extends Model class Joined extends Model
{ {
use HasFactory; use HasFactory;
use Ownable;
use Categorizable; use Categorizable;
use Imageable; use Imageable;
@ -29,10 +31,7 @@ class Joined extends Model
/* ----------------------------------------------------------------------- relationships ---- */ /* ----------------------------------------------------------------------- relationships ---- */
public function collective() // injected by trait: collective (belongsTo)
{
return $this->belongsTo(Collective::class);
}
// injected by trait: categories (morph many-to-many) // injected by trait: categories (morph many-to-many)

View file

@ -2,12 +2,20 @@
namespace App\Models; 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\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Owned extends Model class Owned extends Model
{ {
use HasFactory; use HasFactory;
use Ownable;
use Categorizable;
use Imageable;
protected $table = 'owned'; protected $table = 'owned';
/* ----------------------------------------------------------------------- relationships ---- */
} }

13
app/Traits/Ownable.php Normal file
View 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);
}
}

View file

@ -35,7 +35,7 @@ public function definition()
'status' => $statuses->random(), 'status' => $statuses->random(),
'slug' => $this->faker->slug(2, false), 'slug' => $this->faker->slug(2, false),
'title' => $this->faker->words(3, true), 'title' => $this->faker->words(3, true),
'image' => $this->faker->image(), 'image' => $this->faker->imageUrl(),
'hold_member_updates' => $this->faker->boolean(), 'hold_member_updates' => $this->faker->boolean(),
'notify_pending' => $this->faker->boolean(), 'notify_pending' => $this->faker->boolean(),
'sort_by' => 'country', 'sort_by' => 'country',

View file

@ -13,7 +13,7 @@ .form__input--file::-webkit-file-upload-button {
-webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s; -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; 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; border: 1px solid #7874ff;
padding: 5px 10px; padding: 5px 10px;
margin-right: 5px; 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; -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; 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; border-color: #de7cff;
background-color: #f8e5ff; background-color: #f8e5ff;
color: #de7cff; 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; -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; 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; border-color: #de7cff;
background-color: #f8e5ff; background-color: #f8e5ff;
color: #de7cff; color: #de7cff;

View file

@ -124,7 +124,7 @@ h1 {
&:first-of-type { margin-top: 20px; } &:first-of-type { margin-top: 20px; }
} }
.form__btn { .input--btn {
@extend %btn; @extend %btn;
} }

View file

@ -24,7 +24,9 @@
<span class="l-nav__link">joined</span> <span class="l-nav__link">joined</span>
</a> </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> <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()" <x-admin.form.destroy :btnClass="'l-nav__tab'" :object="auth_collective()"

View 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

View file

@ -24,8 +24,8 @@ class="form__input--checkbox">
</div> </div>
<div class="form__btns"> <div class="form__btns">
<input type="submit" class="form__btn" value="Submit"> <input type="submit" class="input--btn" value="Submit">
<input type="reset" class="input__btn" value="Reset"> <input type="reset" class="input--btn" value="Reset">
</div> </div>
</fieldset> </fieldset>
</form> </form>

View file

@ -8,8 +8,8 @@
]) ])
<div class="form__btns {{ $divClass }}"> <div class="form__btns {{ $divClass }}">
<input type="submit" class="form__btn {{ $submitClass }} {{ $btnClass }}" <input type="submit" class="input--btn {{ $submitClass }} {{ $btnClass }}"
value="{{ $submitValue }}"> value="{{ $submitValue }}">
<input type="reset" class="form__btn {{ $resetClass }} {{ $btnClass }}" <input type="reset" class="input--btn {{ $resetClass }} {{ $btnClass }}"
value="{{ $resetValue }}"> value="{{ $resetValue }}">
</div> </div>

View file

@ -2,7 +2,9 @@
use App\Http\Controllers\CollectiveController; use App\Http\Controllers\CollectiveController;
use App\Http\Controllers\JoinedController; use App\Http\Controllers\JoinedController;
use App\Http\Controllers\OwnedController;
use App\Http\Controllers\SessionsController; use App\Http\Controllers\SessionsController;
use App\Models\Owned;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/* /*
@ -18,12 +20,9 @@
Route::redirect('/fanatic', '/fanatic/login')->middleware('guest'); Route::redirect('/fanatic', '/fanatic/login')->middleware('guest');
Route::middleware('guest')->group(function () { Route::middleware('guest')->group(function () {
Route::get('/fanatic/login', [SessionsController::class, 'create']) Route::get('/fanatic/login', [SessionsController::class, 'create'])->name('admin.sessions.create');
->name('admin.sessions.create'); Route::get('/fanatic/install', [CollectiveController::class, 'create'])->name('admin.collectives.create');
Route::get('/fanatic/install', [CollectiveController::class, 'create']) Route::post('/fanatic', [CollectiveController::class, 'store'])->name('admin.collectives.store');
->name('admin.collectives.create');
Route::post('/fanatic', [CollectiveController::class, 'store'])
->name('admin.collectives.store');
}); });
Route::post('/fanatic', [SessionsController::class, 'store'])->name('admin.sessions.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::get('/fanatic', [CollectiveController::class, 'dashboard'])->name('admin.dashboard');
Route::delete('/fanatic', [SessionsController::class, 'destroy'])->name('admin.sessions.destroy'); Route::delete('/fanatic', [SessionsController::class, 'destroy'])->name('admin.sessions.destroy');
Route::get('/fanatic/joined', [JoinedController::class, 'index']) // joined
->name('admin.joined.index'); Route::get('/fanatic/joined', [JoinedController::class, 'index'])->name('admin.joined.index');
Route::get('/fanatic/joined/create', [JoinedController::class, 'create']) Route::get('/fanatic/joined/create', [JoinedController::class, 'create'])->name('admin.joined.create');
->name('admin.joined.create'); Route::post('/fanatic/joined', [JoinedController::class, 'store'])->name('admin.joined.store');
Route::post('/fanatic/joined', [JoinedController::class, 'store']) Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit'])->name('admin.joined.edit');
->name('admin.joined.store'); Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update'])->name('admin.joined.update');
Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit']) Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy'])->name('admin.joined.destroy');
->name('admin.joined.edit');
Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update']) // owned
->name('admin.joined.update'); Route::get('/fanatic/owned', [OwnedController::class, 'index'])->name('admin.owned.index');
Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy']) Route::get('/fanatic/owned/create', [OwnedController::class, 'create'])->name('admin.owned.create');
->name('admin.joined.destroy'); 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');
}); });