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

namespace App\Http\Controllers\Admin;

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

class SubscriberController extends Controller
{

    public function index(Request $request)
    {
        $subscribers = Subscriber::latest()->get();
        return view('backend.pages.subscriber.index')->with(compact('subscribers'));
    }

    // public function delete($id)
    // {
    //     $subscribers = Subscriber::findOrFail($id);
    //     $subscribers->delete();
    //     Toastr::success('Success!', 'Subscriber deleted successfully!');
    //     return redirect()->back();
    // }

    public function pending(Request $request)
    {
        $subscribers = Subscriber::where('payment_status', '!=', 'paid')->latest()->get();
        return view('backend.pages.subscriber.index')->with(compact('subscribers'));
    }

    public function paid(Request $request)
    {
        $subscribers = Subscriber::where('payment_status', 'paid')->latest()->get();
        return view('backend.pages.subscriber.index')->with(compact('subscribers'));
    }


    public function invoiceDetails($id)
    {
        $invoice = Subscriber::with('user:id,name,industry,email,package_id,type,address,products,country_id','package')->where('id', $id)->firstOrFail();
        return view('backend.pages.subscriber.invoice', compact('invoice'));
    }

    public function moneyReceipt($id)
    {
        $money_receipt = Subscriber::where('id', $id)->firstOrFail();
        return view('backend.pages.subscriber.money_receipt', compact('money_receipt'));
    }
}