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.'); 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) public function show(Joined $joined)
{ {
// //

View file

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

View file

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

View file

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

View file

@ -18,34 +18,32 @@
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']) Route::get('/fanatic/install', [CollectiveController::class, 'create'])
->name('admin.collectives.create'); ->name('admin.collectives.create');
Route::post('/fanatic', [CollectiveController::class, 'store']) Route::post('/fanatic', [CollectiveController::class, 'store'])
->name('admin.collectives.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');
Route::middleware('auth')->group(function () { Route::middleware('auth')->group(function () {
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']) Route::get('/fanatic/joined', [JoinedController::class, 'index'])
->name('admin.joined.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']) Route::post('/fanatic/joined', [JoinedController::class, 'store'])
->name('admin.joined.store'); ->name('admin.joined.store');
Route::patch('/fanatic/joined/{joined}/approve', [JoinedController::class, 'approve']) Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show'])
->name('admin.joined.approve'); ->name('admin.joined.show');
Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show']) Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit'])
->name('admin.joined.show'); ->name('admin.joined.edit');
Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit']) Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update'])
->name('admin.joined.edit'); ->name('admin.joined.update');
Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update']) Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy'])
->name('admin.joined.update'); ->name('admin.joined.destroy');
Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy'])
->name('admin.joined.destroy');
}); });

View file

@ -1,5 +1,8 @@
<?php <?php
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Test Case | 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 abstract class TestCase extends BaseTestCase
{ {
use CreatesApplication; use CreatesApplication;
protected $seed = true;
} }