/** * Remove the specified resource from storage. * * @param int $id * * @return \Illuminate\Http\Response */ public function postDestroy($id) { $response['status'] = 'error'; $response['message'] = trans('categories.not_removed'); if (!empty($id) && intval($id) > 0) { if (Model_Categories::removeCategory($id) === TRUE) { $response['status'] = 'success'; $response['message'] = trans('categories.removed'); } } return response()->json($response); }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function getEdit($id) { $response['pageTitle'] = trans('sliders.edit'); $response['blade_custom_css'] = ['global/plugins/jquery-minicolors/jquery.minicolors', 'global/plugins/dropzone/css/dropzone', 'global/plugins/select2/select2', 'global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min']; $response['blade_custom_js'] = ['global/plugins/jquery-minicolors/jquery.minicolors.min', 'global/plugins/dropzone/dropzone', 'admin/pages/scripts/form-dropzone', 'global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2.min', 'admin/pages/scripts/components-dropdowns', 'global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min']; $response['images_dir'] = Config::get('system_settings.sliders_upload_path'); $response['public_images_dir'] = Config::get('system_settings.sliders_public_path'); $response['categories'] = Model_Categories::getCategory(FALSE, ['title']); $response['pages'] = Model_Pages::getPage(FALSE, ['id', 'title']); $response['slider'] = Model_Sliders::getSliders($id, FALSE, ['id', 'title', 'dir', 'active_from', 'active_to', 'position', 'type', 'target']); if (!empty($response['slider']) && !empty($response['slider'][0])) { $response['slider'] = $response['slider'][0]; } if (!empty($response['slider']['active_from']) && $response['slider']['active_from'] == '0000-00-00 00:00:00') { $response['slider']['active_from'] = ''; } if (!empty($response['slider']['active_to']) && $response['slider']['active_to'] == '0000-00-00 00:00:00') { $response['slider']['active_to'] = ''; } return Theme::view('sliders.create_edit_slider', $response); }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function getEdit($id = FALSE) { $customCSS = ['global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5', 'global/plugins/bootstrap-summernote/summernote', 'global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2', 'global/plugins/jquery-multi-select/css/multi-select', 'global/plugins/bootstrap-switch/css/bootstrap-switch.min', 'global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min', 'global/plugins/dropzone/css/dropzone']; $customJS = ['global/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0', 'global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5', 'global/plugins/bootstrap-summernote/summernote.min', 'admin/pages/scripts/components-dropdowns', 'global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2.min', 'global/plugins/jquery-multi-select/js/jquery.multi-select', 'global/plugins/fuelux/js/spinner.min', 'global/plugins/bootstrap-switch/js/bootstrap-switch.min', 'global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min', 'global/plugins/dropzone/dropzone', 'admin/pages/scripts/form-dropzone', 'global/plugins/jquery-slugify/speakingurl', 'global/plugins/jquery-slugify/slugify.min']; $response['blade_custom_css'] = $customCSS; $response['blade_custom_js'] = $customJS; $response['categories'] = Model_Categories::getCategory(FALSE, ['title']); $response['related_categories'] = Model_Products::getProductToCategory($id); $response['products'] = Model_Products::getProducts(FALSE, ['title']); $response['groups'] = Model_Sizes::getSizes(TRUE); $response['colors'] = Model_Products::getColors(); $response['related_colors'] = Model_Products::getColor($id); $response['dimensions_tables'] = Model_Tables::getTables(); if (!empty($response['dimensions_tables']) && is_array($response['dimensions_tables'])) { foreach ($response['dimensions_tables'] as $key => $table) { if (isset($table['image'])) { unset($response['dimensions_tables'][$key]['image']); } } } //Get product and it's data $product = Model_Products::getProducts($id); //Prepare product for response if (!empty($product[$id])) { $response['product'] = $product[$id]; if (!empty($product[$id]['sizes'])) { $response['sizes'] = json_decode($product[$id]['sizes'], TRUE); } if (!empty($response['product']['discount_start']) && $response['product']['discount_start'] == '0000-00-00 00:00:00') { $response['product']['discount_start'] = ''; } if (!empty($response['product']['discount_end']) && $response['product']['discount_end'] == '0000-00-00 00:00:00') { $response['product']['discount_end'] = ''; } } //SEO Tab if (($slug = Model_Products::getURL($id)) != FALSE) { $response['seo']['friendly_url'] = $slug; } if (!empty($response['product']['page_title'])) { $response['seo']['page_title'] = $response['product']['page_title']; unset($response['product']['page_title']); } if (!empty($response['product']['meta_description'])) { $response['seo']['meta_description'] = $response['product']['meta_description']; unset($response['product']['meta_description']); } if (!empty($response['product']['meta_keywords'])) { $response['seo']['meta_keywords'] = $response['product']['meta_keywords']; unset($response['product']['meta_keywords']); } //Images Tab if (!empty($response['product']['images'])) { $response['product']['images'] = json_decode($response['product']['images'], TRUE); if (is_array($response['product']['images'])) { $response['thumbs_path'] = Config::get('system_settings.product_public_path') . $id . '/' . Config::get('images.sm_icon_size') . '/'; uasort($response['product']['images'], function ($a, $b) { if ($a == $b) { return 0; } return $a < $b ? -1 : 1; }); } } //Tags $tags = Model_Products::getTags($id); if (!empty($tags) && is_array($tags)) { foreach ($tags as $key => $tag) { $response['product']['tags'][] = $tag['title']; } $response['product']['tags'] = implode(',', $response['product']['tags']); } //Manufacturer $response['manufacturers'] = Model_Products::getManufacturers(); $response['product']['manufacturer'] = Model_Products::getManufacturer($id); //Material $response['materials'] = Model_Products::getMaterials(); $response['product']['material'] = Model_Products::getMaterial($id); if (!empty($response['product']['material'][0])) { $response['product']['material'] = $response['product']['material'][0]; } //Related products if (!empty($response['product']['related_products'])) { $response['related_products'] = json_decode($response['product']['related_products'], TRUE); unset($response['product']['related_products']); } $response['pageTitle'] = trans('products.edit'); return Theme::view('products.edit_product', $response); }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function getEdit($id) { $response['pageTitle'] = trans('carousels.edit'); $response['blade_custom_css'] = ['global/plugins/select2/select2', 'global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min']; $response['blade_custom_js'] = ['global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2.min', 'admin/pages/scripts/components-dropdowns', 'global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min']; $response['categories'] = Model_Categories::getCategory(FALSE, ['title']); $response['pages'] = Model_Pages::getPage(FALSE, ['id', 'title']); $response['products'] = Model_Products::getProducts(FALSE, ['title']); $response['carousel'] = Model_Carousels::getCarousels($id, FALSE); if (!empty($response['carousel']) && !empty($response['carousel'][0])) { $response['carousel'] = $response['carousel'][0]; } if (!empty($response['carousel']['products']) && $response['carousel']['products'] == 'newest' || $response['carousel']['products'] == 'discounted') { $response['carousel']['slider_type'] = $response['carousel']['products']; } else { $response['carousel']['slider_type'] = 'others'; } if (!empty($response['carousel']['products']) && $response['carousel']['slider_type'] == 'others') { $response['carousel']['products'] = is_array(json_decode(',', $response['carousel']['products'], TRUE)) ? json_decode(',', $response['carousel']['products'], TRUE) : explode(',', $response['carousel']['products']); } if (!empty($response['carousel']['active_from']) && $response['carousel']['active_from'] == '0000-00-00 00:00:00') { $response['carousel']['active_from'] = ''; } if (!empty($response['carousel']['active_to']) && $response['carousel']['active_to'] == '0000-00-00 00:00:00') { $response['carousel']['active_to'] = ''; } return Theme::view('carousels.create_edit_carousel', $response); }