/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $order) { $entry = new Entry($order); $entry->field('id')->field('firstname')->field('lastname')->field('address1')->field('address2')->field('zipcode')->field('city')->field('country')->field('phone_work')->field('phone_home')->field('phone_mobile')->field('other_informations'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $category) { $entry = new Entry($category); $entry->field('id')->field('label')->field('slug')->field('parent')->field('position'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $product) { $entry = new Entry($product); $entry->field('id')->field('name')->field('description')->field('sku')->field('status')->field('price')->field('sale_price')->field('quantity')->value('image', $product->product->defaultImage())->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $user) { $entry = new Entry($user); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('uid')->field('email')->field('firstname')->field('lastname')->compositeField('displayName', 'firstname', 'lastname')->relationshipField('addresses', 'Subbly\\Presenter\\V1\\UserAddressPresenter')->integer('orders_total', $user->countOrders())->relationshipField('orders', 'Subbly\\Presenter\\V1\\OrderPresenter')->relationshipField('groups', 'Subbly\\Presenter\\V1\\GroupPresenter')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $product) { $entry = new Entry($product); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('position')->field('name')->field('description')->field('sku')->field('status')->field('price')->field('sale_price')->field('quantity')->relationshipField('images', 'Subbly\\Presenter\\V1\\ProductImagePresenter')->relationshipField('options', 'Subbly\\Presenter\\V1\\ProductOptionPresenter')->relationshipField('categories', 'Subbly\\Presenter\\V1\\ProductCategoryPresenter')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $group) { $entry = new Entry($group); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('name')->field('permissions')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $order) { $entry = new Entry($order); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('uid')->field('status')->decimal('total_price', (double) $order->total_price)->integer('total_items', (int) $order->total_items)->decimal('shipping_cost', (double) $order->shipping_cost)->relationshipField('user', 'Subbly\\Presenter\\V1\\UserPresenter')->relationshipField('billing_address', 'Subbly\\Presenter\\V1\\OrderAddressPresenter')->relationshipField('shipping_address', 'Subbly\\Presenter\\V1\\OrderAddressPresenter')->relationshipField('products', 'Subbly\\Presenter\\V1\\OrderProductPresenter')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $userAddress) { $entry = new Entry($userAddress); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('uid')->field('name')->field('firstname')->field('lastname')->field('address1')->field('address2')->field('zipcode')->field('city')->field('country')->field('phone_work')->field('phone_home')->field('phone_mobile')->field('others_informations')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }
/** * Get formated datas for a collection. * * @param \Subbly\Model\Collection $collection * * @return \Illuminate\Support\Collection */ public function collection(Collection $collection) { $entries = new Entries(); foreach ($collection as $productImage) { $entry = new Entry($productImage); $entry->conditionalField('id', function () { return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth'); })->field('filename')->field('product')->field('uid')->field('position')->dateField('created_at')->dateField('updated_at'); $entries->addEntry($entry); } return $entries->toArray(); }