feat: add admin controllers
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UpdatePaymentRequest;
|
||||
use App\Models\Payment;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$payments = Payment::with(['user'])
|
||||
->latest()
|
||||
->paginate(15);
|
||||
|
||||
return view('admin.payments.index', compact('payments'));
|
||||
}
|
||||
|
||||
public function show(Payment $payment)
|
||||
{
|
||||
return view('admin.payments.show', compact('payment'));
|
||||
}
|
||||
|
||||
public function edit(Payment $payment)
|
||||
{
|
||||
return view('admin.payments.edit', compact('payment'));
|
||||
}
|
||||
|
||||
public function update(UpdatePaymentRequest $request, Payment $payment)
|
||||
{
|
||||
$payment->update($request->safe()->only(['status']));
|
||||
|
||||
return redirect()
|
||||
->route('admin.payments.index')
|
||||
->with('success', 'وضعیت پرداخت با موفقیت بهروزرسانی شد.');
|
||||
}
|
||||
|
||||
public function destroy(Payment $payment)
|
||||
{
|
||||
$payment->delete();
|
||||
|
||||
return redirect()
|
||||
->route('admin.payments.index')
|
||||
->with('success', 'پرداخت با موفقیت حذف شد.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user