<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\WalletTransaction;
use Illuminate\Http\Request;

class WalletTransactionController extends Controller
{
   public function __construct()
    {
        $this->middleware('permission:view wallet transactions', ['only' => ['index', 'show']]);
        $this->middleware('permission:create wallet transactions', ['only' => ['create', 'store']]);
        $this->middleware('permission:update wallet transactions', ['only' => ['edit', 'update']]);
        $this->middleware('permission:delete wallet transactions', ['only' => ['destroy']]);
    }

    public function index()
    {
        $walletTransactions = WalletTransaction::with(['user', 'wallet', 'sharedSubscription'])
            ->latest()
            ->paginate(25);

        return view('admin.wallet-transactions.index', compact('walletTransactions'));
    }

    public function create()
    {
        return redirect()->route('admin.wallet-transactions.index');
    }

    public function store(Request $request)
    {
        abort(405);
    }

    public function show(string $id)
    {
        return redirect()->route('admin.wallet-transactions.index');
    }

    public function edit(string $id)
    {
        return redirect()->route('admin.wallet-transactions.index');
    }

    public function update(Request $request, string $id)
    {
        abort(405);
    }

    public function destroy(string $id)
    {
        abort(405);
    }
}
