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;
@ -18,11 +17,19 @@ public function render()
if ($this->class == 'joined') { if ($this->class == 'joined') {
$fanlistings = auth_collective()->joined()->paginate(8); $fanlistings = auth_collective()->joined()->paginate(8);
} elseif ($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

@ -38,8 +38,6 @@
->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'])
->name('admin.joined.approve');
Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show']) Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show'])
->name('admin.joined.show'); ->name('admin.joined.show');
Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit']) Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit'])

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;
} }