Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationships #54

Open
VoronVoronov opened this issue May 28, 2021 · 3 comments
Open

Relationships #54

VoronVoronov opened this issue May 28, 2021 · 3 comments

Comments

@VoronVoronov
Copy link

VoronVoronov commented May 28, 2021

Controller:
public function shoppabletags($id){
app('debugbar')->disable();
$user= Auth::user();
$shop = Shop::where('user_id', $user->id)->where('shop_tariffs', '>=', 3)->first();
$module = Modules::where('shop_id', $shop->shop_id)->where('module_type', 1)->first();
$link = json_decode($module->module_feautures);
if($id == $link->link) {
$category = Category::where('shop_id', $shop->shop_id)->with('goods')->get();
$csvExporter = new Export();
$csvExporter->build($category, ['goods.goods_id' => 'id','goods.goods_name' => 'title','goods.goods_link' => 'link','goods.goods_main_photo' => 'image_link','goods.goods_availability' => 'availability', 1 => 'inventory','goods.goods_amount' => 'price','goods.goods_about' => 'description','goods.goods_condition' => 'condition'])->download();
}
}

model:
public function goods()
{
return $this->hasMany(Goods::class, 'category_id', 'category_id');
}

Specifying the bundle according to the table, but not output the records in CSV, can you tell me?

@VoronVoronov
Copy link
Author

@VoronVoronov
Copy link
Author

image
The file that is generated is empty

@saularis
Copy link
Contributor

@VoronVoronov If you dump $category do you get your expected result? If not, what error do you get?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants