<?php

namespace App\Http\Controllers\Shop;
use App\Models\Reseller;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;

class CustomPageController extends Controller
{
    public function index($username,$slug){
        $resellers = Reseller::where('username',$username)->first();
        $page = DB::table('pages')->where('reseller_id', $resellers->id)->where('slug', $slug)->select('id','name','slug','details')->first();
        $pages = DB::table('pages')->where('reseller_id', $resellers->id)->get();
        $data = [
            'resellers' => $resellers,
            'page' => $page,
            'pages' => $pages
        ];
        return view('shop.pages.custom_page', $data);
    }
}
