<?php
$options = array('http' =>
[
'method' => 'GET',
'header' => "X-Auth-Token: <token>\r\n"
]
);
$context = stream_context_create($options);
$result = file_get_contents('https://kaspi.kz/shop/api/v2/orders?page[number]=0&page[size]=20&filter[orders][state]=NEW
&filter[orders][creationDate][$ge]=1478736000000&filter[orders][creationDate][$le]=1479945600000
&filter[orders][status]=APPROVED_BY_BANK&filter[orders][deliveryType]=PICKUP
&filter[orders][signatureRequired]=false&include[orders]=user', false, $context);
var_dump($result);
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'slug' => $this->slug,
'author' => new AuthorResource($this->mod_author),
'sticky' => $this->sticky,
'categories' => CategoryResource::collection($this->categories),
'files' => [
'archives' => FileResource::collection($this->files->where('type', '=', 'archive')),
'images' => FileResource::collection($this->files->where('type', '=', 'images')),
'thumbnail' => FileResource::collection($this->files->where('type', '=', 'thumbnail'))
]
];
}
public function index()
{
$mods = Mod::with('categories')
->with('mod_author')
->with(['files' => function($query){
return $query->where('type', 'mod');
}])
->paginate('10');
return ModResource::collection($mods);
}
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'slug' => $this->slug,
'author' => new AuthorResource($this->mod_author),
'sticky' => $this->sticky,
'categories' => CategoryResource::collection($this->categories),
'files' => $this->whenLoaded('files', [
'archives' => $this->files,
])
];
}
public function delete(User $user, Menu $menu) {
// dd($menu->project->id, $menu->project_id);
return $this->projectPolicy->isAdmin($user, $menu->project);
}
public function delete(User $user, Menu $menu) {
return $user->can('delete-menu', $menu->project);
}
public function items(): BelongsToMany
{
return $this->belongsToMany(CartProduct::class, 'cart_products');
}
public function items(): BelongsToMany
{
return $this->belongsToMany(ProductVariant::class, 'cart_products');
}
select * from products where (select count(*) from product_country where product_country.product_id = products.id and product_country.country_id in (1,2)) == 2;
select * from products where (select count(*) from product_country where product_country.product_id = products.id and product_country.country_id in (1,2,3)) == 3;