App\Http\Controllers\FreeProductsController::show PHP Method

show() public method

Return the product data free query view.
public show ( integer $id ) : View
$id integer of freeproduct
return View
    public function show($id)
    {
        $freeproduct = FreeProduct::with('orders')->find($id);
        if ($freeproduct) {
            //Get Total equity investments in the product user free
            $userholdings = FreeProductParticipant::MyParticipations($id)->count();
            $isParticipating = $freeproduct->max_participations_per_user > $userholdings ? 0 : 1;
            $panel = $this->panel;
            return view('freeproducts.show', compact('freeproduct', 'isParticipating', 'panel'));
        } else {
            Session::flash('message', trans('freeproduct.freeproduct_not_exist'));
            return redirect(route('products'));
        }
    }