Current File : //home/tradevaly/www/app/Http/Controllers/Admin/TransactionController.php
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Transaction;
use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Http\Request;

class TransactionController extends Controller
{

    public function index(Request $request)
    {
        $transactions = Transaction::latest()->get();
        return view('backend.pages.transaction.index',['transactions' => $transactions]);
    }
    public function details($id)
    {
        
        $transaction = Transaction::findOrFail($id);
        $view = 'backend.pages.transaction.index';
        if(!empty($transaction->subscriber)){
            $view = 'backend.pages.transaction.subcriber_details';
        }
        
        if(!empty($transaction->advertiser)){
            $view = 'backend.pages.transaction.advertiser_details';
        }
        return view($view,compact('transaction'));
    }
}