<?php

namespace App\Http\Controllers\Admin;

# Models
use App\Models\Bit;
use App\Models\BracketBit;

# Other Classes
use DB;
use Validator;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;

class RedBracketBitController extends Controller
{
     # Define Base view
    protected $view = 'admin.red-bracket.';
      #Bind Bit model
    protected $bit;

     #Bind BracketBit model
    protected $bracketBit;


    /**
      * Defining the default constructor for controller
      *
      */
    public function __construct(
                                Bit $bit,
                                BracketBit $bracketBit
                            )
    {
        $this->bit  = $bit;
        $this->bracketBit       = $bracketBit;
        
    }
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
         try
        {
              
            #relationship
            $relation = ['bit','bit.store','username'];
            #get all paymentUser resources
           
            $details['lists'] = $this->bracketBit->with($relation)->where('created_at','!=',null)->paginate(10);

            #render view
            return view($this->view.'index',$details);
        }catch(\Exception $ex)
        {
            return back()->with('error', $ex->getMessage());
        }
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
