This commit is contained in:
Marley Rae 2022-04-26 11:15:27 -07:00
parent ec631823b9
commit a28017c475
7 changed files with 48 additions and 40 deletions

View file

@ -41,12 +41,6 @@ public function store(StoreJoinedRequest $request)
return redirect()->route('admin.joined.index')->with('success', 'Fanlisting added.');
}
public function approve(Joined $joined)
{
$joined->approve();
return redirect()->route('admin.joined.index')->with('success', 'Fanlisting approved.');
}
public function show(Joined $joined)
{
//

View file

@ -3,7 +3,6 @@
namespace App\Http\Livewire\Admin;
use App\Models\Joined;
use Illuminate\Pagination\LengthAwarePaginator;
use Livewire\Component;
use Livewire\WithPagination;
@ -17,12 +16,20 @@ public function render()
{
if ($this->class == 'joined') {
$fanlistings = auth_collective()->joined()->paginate(8);
} else if ($this->class == 'owned') {
//
} elseif ($this->class == 'owned') {
// TODO: add owned class
}
return view('livewire.admin.list-fanlistings', [
'fanlistings' => $fanlistings,
]);
}
public function approve(Joined $fl)
{
if ($fl->approved == false) {
$fl->approved = true;
$fl->save();
}
}
}

View file

@ -41,15 +41,15 @@
</nav>
@if (session()->has('success'))
<p class="success">{{ session()->get('success') }}</p>
<p class="success alert">{{ session()->get('success') }}</p>
@endif
@if (session()->has('error'))
<p class="error">{{ session()->get('error') }}</p>
<p class="error alert">{{ session()->get('error') }}</p>
@endif
@if (session()->has('warning'))
<p class="warning">{{ session()->get('warning') }}</p>
<p class="warning alert">{{ session()->get('warning') }}</p>
@endif
@yield('content')
@ -58,5 +58,9 @@
</div>
<livewire:scripts />
<script>
var timeout = 3000; // in miliseconds (3*1000)
$('.alert').delay(timeout).fadeOut(300);
</script>
</body>
</html>

View file

@ -23,10 +23,10 @@
<td><img src="{{ $fl->image }}"></td>
<td>
@if ($class == 'joined')
<a href="{{ route('admin.joined.approve', $fl) }}" class="btn--table">
@if ($class == 'joined' && $fl->approved == false)
<button wire:click="approve({{ $fl }})" class="btn--table">
Approve
</a>
</button>
@elseif ($class == 'owned')
<a href="#" class="btn--table">View</a>
@endif

View file

@ -18,34 +18,32 @@
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');
Route::middleware('auth')->group(function () {
Route::get('/fanatic', [CollectiveController::class, 'dashboard'])->name('admin.dashboard');
Route::delete('/fanatic', [SessionsController::class, 'destroy'])->name('admin.sessions.destroy');
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::patch('/fanatic/joined/{joined}/approve', [JoinedController::class, 'approve'])
->name('admin.joined.approve');
Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show'])
->name('admin.joined.show');
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');
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}', [JoinedController::class, 'show'])
->name('admin.joined.show');
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');
});

View file

@ -1,5 +1,8 @@
<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
/*
|--------------------------------------------------------------------------
| Test Case
@ -11,7 +14,7 @@
|
*/
uses(Tests\TestCase::class)->in('Feature');
uses(Tests\TestCase::class, RefreshDatabase::class, WithFaker::class)->in('Feature');
/*
|--------------------------------------------------------------------------

View file

@ -7,4 +7,6 @@
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
protected $seed = true;
}