I have a file called create.blade.php
inside directory resources/views/product/create.blade.php
.
I am trying to view the create.blade.php
file inside index.blade.php
that is located in resources/views/product/index.blade.php
using include @include('product.create')
.
The issue is that when I try to call the view, I get the error
below is the productController
class:
public $barcode_types;
/**
* Constructor
*
* @param ProductUtils $product
* @return void
*/
public function __construct(ProductUtil $productUtil, ModuleUtil $moduleUtil)
{
$this->productUtil = $productUtil;
$this->moduleUtil = $moduleUtil;
//barcode types
$this->barcode_types = $this->productUtil->barcode_types();
}
public function create()
{
if (!auth()->user()->can('product.create')) {
abort(403, 'Unauthorized action.');
}
$business_id = request()->session()->get('user.business_id');
//Check if subscribed or not, then check for products quota
if (!$this->moduleUtil->isSubscribed($business_id)) {
return $this->moduleUtil->expiredResponse();
} elseif (!$this->moduleUtil->isQuotaAvailable('products', $business_id)) {
return $this->moduleUtil->quotaExpiredResponse('products', $business_id, action('ProductController@index'));
}
$categories = Category::forDropdown($business_id, 'product');
$brands = Brands::forDropdown($business_id);
$units = Unit::forDropdown($business_id, true);
$tax_dropdown = TaxRate::forBusinessDropdown($business_id, true, true);
$taxes = $tax_dropdown['tax_rates'];
$tax_attributes = $tax_dropdown['attributes'];
$barcode_types = $this->barcode_types;
$barcode_default = $this->productUtil->barcode_default();
$default_profit_percent = request()->session()->get('business.default_profit_percent');;
//Get all business locations
$business_locations = BusinessLocation::forDropdown($business_id);
//Duplicate product
$duplicate_product = null;
$rack_details = null;
$sub_categories = [];
if (!empty(request()->input('d'))) {
$duplicate_product = Product::where('business_id', $business_id)->find(request()->input('d'));
$duplicate_product->name .= ' (copy)';
if (!empty($duplicate_product->category_id)) {
$sub_categories = Category::where('business_id', $business_id)
->where('parent_id', $duplicate_product->category_id)
->pluck('name', 'id')
->toArray();
}
//Rack details
if (!empty($duplicate_product->id)) {
$rack_details = $this->productUtil->getRackDetails($business_id, $duplicate_product->id);
}
}
$selling_price_group_count = SellingPriceGroup::countSellingPriceGroups($business_id);
$module_form_parts = $this->moduleUtil->getModuleData('product_form_part');
$product_types = $this->product_types();
$common_settings = session()->get('business.common_settings');
$warranties = Warranty::forDropdown($business_id);
//product screen view from module
$pos_module_data = $this->moduleUtil->getModuleData('get_product_screen_top_view');
return view('product.create')
->with(compact('categories', 'brands', 'units', 'taxes', 'barcode_types', 'default_profit_percent', 'tax_attributes', 'barcode_default', 'business_locations', 'duplicate_product', 'sub_categories', 'rack_details', 'selling_price_group_count', 'module_form_parts', 'product_types', 'common_settings', 'warranties', 'pos_module_data'));
}
What am I doing wrong here?
are there further steps or configuration to be done before calling the view?