/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     \Excel::load('MiRO_All Products_Pricelist.xls', function ($reader) {
         // Get workbook title
         $results = $reader->get();
         $workbookTitle = $results->getTitle();
         echo "workbookTitle: " . $workbookTitle . "<br>";
         //            $n = 0;
         foreach ($results as $sheet) {
             // get sheet title
             $sheetTitle = $sheet->getTitle();
             echo "sheetTitle: " . $sheetTitle . "<br>";
             // Check if Category exists, and if so, get category ID
             $category = Cat::where('name', $sheetTitle)->first();
             if ($category) {
                 //echo "Category exists id'" . $category->id . "'<br>";
             } else {
                 echo "Category does not exist, now adding<br>";
                 $category = new Cat();
                 $category->name = $sheetTitle;
                 $category->save();
             }
             foreach ($sheet as $cells) {
                 // Check if it's an empty line, and if so, assume this is a subcategory
                 // Check if valid data before loading into products array
                 if ($cells->sku && $cells->name && $cells->qty_1) {
                     // Check if product exists, if not, add it
                     //echo "Sheet sku: " . $cells->sku . "<br>";
                     $product = Product::where('sku', $cells->sku)->first();
                     if ($product) {
                         // Update product
                         //echo "Found a product with this SKU, updating<br>";
                         $product->name = $cells->name;
                         $product->price1 = $cells->qty_1;
                         $product->cat_id = $category->id;
                         $product->save();
                     } else {
                         // Create product
                         echo "Can't find a product with this SKU, creating<br>";
                         $product = new Product();
                         $product->sku = $cells->sku;
                         $product->name = $cells->name;
                         $product->price1 = $cells->qty_1;
                         $product->cat_id = $category->id;
                         $product->save();
                     }
                 }
                 //                    $n = $n + 1;
                 //                    if ($n > 10) {
                 //                        //break;
                 //                        dd($cells);
                 //                    }
             }
         }
     });
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $cats = Cat::all();
     $bizs = Biz::all();
     $states = State::all();
     return view('admin.index', compact('biz', 'states', 'featured'))->withCats($cats);
 }
예제 #3
0
 public function welcome()
 {
     $cats = Cat::all();
     $products = Product::where('active', 1)->get();
     if ($user = Sentinel::check()) {
         $num = $user->baskets()->where('order_id', 0)->count();
     } else {
         $num = 0;
     }
     return view('welcome', compact('cats', 'products', 'num'));
 }
예제 #4
0
 function horizontalMenuWidget($min, $cat, $value = array(), $options = array(), $max = 0)
 {
     global $registry;
     $ul = false;
     $registry['cat'] = $cat;
     if (count($options) > 0) {
         foreach ($options as $key => $op) {
             $ul .= $key . '=' . $op;
         }
     }
     $entry = Cache::remember('rubrics', $min, function () {
         global $registry;
         if (is_numeric($registry['cat']) and !ctype_alpha($registry['cat'])) {
             return \App\Cat::orderBy('sort', 'asc')->posts($registry['cat'])->get();
         } else {
             $slug = \App\Cat::select('id')->where('slug', $registry['cat'])->first();
             return \App\Cat::orderBy('sort', 'asc')->posts($slug->id)->get();
         }
     });
     $output = '<ul ' . $ul . '>';
     if (count($value) > 0) {
         foreach ($value as $key => $v) {
             $output .= '<li><a href="' . $key . '">' . $v . '</a></li>';
         }
     }
     $i = 0;
     if ($max > 0) {
         foreach ($entry as $item) {
             $i++;
             if ($i <= $max) {
                 $output .= '<li><a href="/cat/' . $item->slug . '">' . $item->name . '</a></li>';
             }
         }
         if (count($entry) > $max) {
             $output .= '<li class="more"><a>' . trans('all.more') . ' <i class="fa fa-caret-right"></i></a><ul>';
             $i = 0;
             foreach ($entry as $item) {
                 $i++;
                 if ($i > $max) {
                     $output .= '<li><a href="/cat/' . $item->slug . '">' . $item->name . '</a></li>';
                 }
             }
             $output .= '</ul></li>';
         }
     } else {
         foreach ($entry as $item) {
             $i++;
             $output .= '<li><a href="/cat/' . $item->slug . '">' . $item->name . '</a></li>';
         }
     }
     $output .= '</ul>';
     return $output;
 }
예제 #5
0
 public function subcat2()
 {
     $query = \Input::get('y');
     $catId = \App\Cat::whereId($query)->first();
     $desc = $catId->meta_description;
     $list = \App\SubCat::where('cat_id', '=', $query)->lists('name', 'id')->all();
     if (count($list) > 0) {
         foreach ($list as $key => $value) {
             $data[] = array('id' => $key, 'text' => $value);
         }
     } else {
         $data[] = array('id' => '0', 'text' => 'No Subcategories found');
     }
     return \Response::json(['data' => $data, 'desc' => $desc]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //return "hello";
     //forget current order session
     if (Auth::check()) {
         $user_id = Auth::user()->id;
     } else {
         $user_id = 0;
     }
     //$view->with('ordersOpen', Order::where('user_id','=', $user_id)->where('status', '=', 'open')->first());
     $type = Cat::with('types')->orderby('name')->get();
     $order = 28;
     //dd($cat);
     //$view->with(['cats'=> $type , 'order' => $order]);
     return View::make('masters.navigation', compact('type'));
 }
예제 #7
0
파일: Cat.php 프로젝트: Vatia13/megaportal
 public function setSlugAttribute($slug_name)
 {
     if (empty($slug_name)) {
         $this->info = Str::generate_ge($this->attributes['name']);
         $slug_name = Cat::where('slug', '=', $this->info)->pluck('slug');
         $this->attributes['slug'] = empty($slug_name) ? $this->info : $this->info . '-' . str_random(5);
     } else {
         if (isset($_REQUEST['_method']) == 'PATCH') {
             $this->info = Str::generate_ge($slug_name);
             $slug_name = Cat::where('slug', '=', $this->info)->count();
             $this->attributes['slug'] = $slug_name <= 1 ? $this->info : $this->info . '-' . str_random(5);
         } else {
             $this->info = Str::generate_ge($slug_name);
             $slug_name = Cat::where('slug', '=', $this->data)->pluck('slug');
             $this->attributes['slug'] = empty($slug_name) ? $this->info : $this->info . '-' . str_random(5);
         }
     }
 }
예제 #8
0
    public function showUnits(Request $request)
    {
        if ($request->ajax() && $request->has('catid')) {
            $units = Cat::find($request->input('catid'))->units;
            $content = "";
            $number = 1;
            foreach ($units as $unit) {
                $content .= '<div>
							 	<span>' . $number . '. ' . $unit->title . '</span>
							 	<input type="text" name="price[' . $unit->id . ']" placeholder="قیمت">
							 	<small>ریال</small>
							 </div>';
                $number++;
            }
            $content .= '<button class="btn btn-sm btn-default"><i class="fa fa-fw fa-plus"></i> واحد جدید</button>';
            return $content;
        }
        return response()->json(['result' => false]);
    }
예제 #9
0
//orders
Route::get('/quote/new', ['as' => 'orders.newquote', 'uses' => 'OrdersController@newquote']);
Route::get('/quote/{id}', ['as' => 'orders.show', 'uses' => 'OrdersController@show']);
Route::get('/listing/{id}', ['as' => 'orders.listing', 'uses' => 'OrdersController@show']);
Route::get('/address/{id}', ['as' => 'orders.address', 'uses' => 'OrdersController@address']);
//orders
Route::get('/orders', ['as' => 'orders.index', 'uses' => 'OrdersController@index']);
Route::post('/orders/edit', ['as' => 'orders.edit', 'uses' => 'OrdersController@edit']);
Route::post('/orders/updateReturn', ['as' => 'orders.updateReturn', 'uses' => 'OrdersController@updateReturn']);
Route::post('/orders/updateDates', ['as' => 'orders.updateDates', 'uses' => 'OrdersController@updateDates']);
Route::post('/orders/updateDelivery', ['as' => 'orders.updateDelivery', 'uses' => 'OrdersController@updateDelivery']);
Route::post('/orders/getQuote', ['as' => 'orders.getQuote', 'uses' => 'OrdersController@getQuote']);
Route::post('/orders/updateAddress', ['as' => 'orders.updateAddress', 'uses' => 'OrdersController@updateAddress']);
//navigation
//Route::get('/topNavigation', [ 'as' => 'navigation.index', 'uses' => 'NavigationController@index' ]);
View::composer('masters.navigation', function ($view) {
    $group = Cat::with('groups')->orderby('name')->get();
    $view->with(['cats' => $group, 'getOrder' => app('App\\getOrder')]);
});
View::composer('masters.header', function ($view) {
    $view->with(['getMeta' => app('App\\getMeta')]);
});
//Route::resource('products', 'ProductsController');
Route::get('/test', function () {
    return View::make('results');
});
Route::get('/content', function () {
    return View::make('content');
});
Route::controller('users', 'UsersController', array('getLogin' => 'users.login', 'getResend' => 'users.resend'));
Route::resource('cutlery', 'CutlerysController');
예제 #10
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $cat = Cat::select('id', 'name', 'parent')->where('id', $id)->orderBy('name')->first();
     $fields = Field::select('id', 'cat_id', 'value', 'trans', 'tag', 'type')->where('cat_id', $cat->id)->get();
     return view('admin.fields.index', compact('cat', 'fields'));
 }
예제 #11
0
            <option value>Не обрано</option>
            <?php 
$cats = \App\Cat::roots()->get();
?>
            @foreach($cats as $category)
                <option @if($category->id == $auction->category)selected @endif value="{{ $category->id }}">{{ $category->name }}</option>
            @endforeach
        </select>
    </div>

    <div class="load_children">
            <div class="form-group @if($errors->has('lot_type'))has-error @endif">
                <label for="lot_type">Тип</label>
                <div id="loadChildren">
                    <?php 
$categories = \App\Cat::find($auction->category);
$categories = $categories->children()->get();
?>
                    <select class="form-control input-lg" name="lot_type">
                        @foreach($categories as $category)
                            <option @if($category->id == $auction->lot_type)selected @endif value="{{ $category->id }}">{{ $category->name }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
    </div>

    <script>


예제 #12
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, User $users)
 {
     $item = Article::findOrFail($id);
     $users = $users->getUsers(['Author', '3rd party content provider', 'Administrator', 'Publisher', 'Frontpage editor', 'Super Admin'], 'name|asc');
     //$users = array_pluck($users,'id');
     $user_names = array();
     $i = 0;
     foreach ($users as $user) {
         foreach ($user->details as $u) {
             $user_names[$user->name] = $u->full_name;
         }
         $i++;
     }
     $users = array_name($user_names);
     $child = $item->categories()->select('cat_id')->first();
     $images = $item->images()->get();
     $image_gallery = [['img' => null, 'title' => null, 'alt' => null, 'source' => null, 'author' => null, 'meta_desc' => null, 'meta_key' => null]];
     if (count($images) > 0) {
         $image_gallery = add_image_array($images);
     }
     if (count(Session::get('_old_input')['image']) > 0) {
         $image_gallery = add_image_array(Session::get('_old_input')['image']);
     }
     $checked_cats = '';
     if (count(Session::get('_old_input')['cat']) > 0) {
         $checked_cats = join(',', Session::get('_old_input')['cat']);
     }
     $parent = Cat::select('parent')->where('id', $child->cat_id)->first()->parent;
     //$cats = $cats->select('id','name')->latest()->postextra(['parent'=>2,'id'=>[5,6,7]])->get();
     $catid = $child->cat_id;
     $extra_fields = get_fields($item->extra_fields);
     $json_extra = '';
     if (count($extra_fields) > 0 && !empty($extra_fields)) {
         $json_extra = json_encode($extra_fields);
     }
     if (count(Session::get('_old_input')['extra_fields']) > 0) {
         $extra_fields = Session::get('_old_input')['extra_fields'];
         $json_extra = json_encode($extra_fields);
     }
     $fields = hasFields([2], ['select' => ['col-sm' => 5], 'input' => ['col-sm' => 5], 'textarea' => ['col-sm' => 9]], $extra_fields);
     return view('admin.articles.edit', compact('item', 'users', 'fields', 'parent', 'catid', 'image_gallery', 'extra_fields', 'checked_cats', 'json_extra'));
 }
예제 #13
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $banner = Banner::findOrFail($id);
     $cats = Cat::select('id', 'name')->posts(26)->get();
     $cats = array_id_name($cats);
     $selected = $banner->categories()->select('cat_id')->where('banner_id', $id)->get()[0]->cat_id;
     return view('admin.banners.edit', compact('cats', 'banner', 'selected'));
 }
예제 #14
0
 /**
  * Cat destroy.
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     // Log::info('Showing user profile for user: '.$id);
     return response()->json(Cat::destroy($id));
 }
예제 #15
0
 public function postUpdateLot(Request $request, $id)
 {
     $category = Cat::find($request->lot_category);
     // Категория в которую добавляем лот
     // Обязательные поля для заполнения: название, категория, область,
     $rights = ['lot_title' => 'required', 'lot_category' => 'required', 'region' => 'required', 'city' => 'required'];
     // Если категория имеет подкатегории - добавляем указание подкатегории обязательным для заполнения полем
     if ($category->children()->count() > 0) {
         $rights = array_add($rights, 'lot_type', 'required');
         // Тип лота
     }
     // Если добавлены прикрепления - добавляем валидацию по расширению файла
     if ($request->hasFile('documents')) {
         //$rights = array_add($rights, 'documents', 'mimes:jpeg,bmp,png,pdf,doc,docx');
     }
     // Если объект свободной продажи
     if ($request->free_sale) {
         // Если выбрана договорная цена - поле стоимости необязательно для заполнения
         if (!$request->negotiable_price) {
             $rights = array_add($rights, 'starting_price', 'required');
             // Стоимость
         }
     } else {
         $rights = array_add($rights, 'starting_price', 'required');
         // Стоимость
         $rights = array_add($rights, 'guarantee_fee', 'required');
         // Гарантийный взнос
         $rights = array_add($rights, 'bid_price', 'required');
         // Цена шага
         $rights = array_add($rights, 'data_start', 'required');
         // Дана начала аукциона
         $rights = array_add($rights, 'date_end', 'required');
         // Дата завершения
     }
     // Запрашиваем список обязательных полей для текущей категории и типа лота
     $rights = $this->getRightsForCategory($request->lot_category, $request->lot_type, $rights);
     // Собственный текст для ошибок
     $messages = array('lot_title.required' => 'Поле «Назва лоту» обязательно для заполнения.', 'lot_category.required' => 'Вы не выбрали категорию лота.', 'lot_image.required' => 'Нужно загрузить хотя бы основную фотографию лота.', 'region.required' => 'Вы не выбрали область.', 'city.required' => 'Поле «Місто» обязательно для заполнения.', 'starting_price.required' => 'Поле «Стартова ціна» обязательно для заполнения.', 'guarantee_fee.required' => 'Поле «Гарантійний внесок» обязательно для заполнения.', 'bid_price.required' => 'Поле «Крок аукціону» обязательно для заполнения.', 'data_start.required' => 'Поле «Дата початку аукціону» обязательно для заполнения.', 'date_end.required' => 'Поле «Дата завершення аукціону» обязательно для заполнения.', 'property_material.required' => 'Вы не выбрали материал здания.', 'property_floors.required' => 'Поле «Кiлькiсть поверхiв» обязательно для заполнения.', 'property_floor.required' => "Поле «Поверх» обов'язково для заповнення.", 'property_areas.required' => 'Поле «Кiмнат/примiщень» обязательно для заполнения.', 'property_totalarea.required' => 'Поле «Загальна площа» обязательно для заполнения.', 'property_livingarea.required' => 'Поле «Житлова площа» обязательно для заполнения.', 'auto_mark.required' => 'Вы не выбрали марку автомобиля.', 'auto_model.required' => 'Поле «Модель» обязательно для заполнения.', 'auto_year.required' => 'Поле «Pік випуску» обязательно для заполнения.', 'auto_transmission.required' => 'Поле «Коробка передач» обязательно для заполнения.', 'auto_drive.required' => 'Поле «Тип привода» обязательно для заполнения.', 'auto_fuel.required' => 'Поле «Тип пального» обязательно для заполнения.', 'auto_doors.required' => 'Поле «Кількість дверей» обязательно для заполнения.');
     // Если добавлены прикрепления - добавляем валидацию по расширению файла
     if ($request->hasFile('documents')) {
         //$rights = array_add($rights, 'documents', 'mimes:jpeg,bmp,png,pdf,doc,docx');
         $files = $request->file('documents');
         $i = 0;
         foreach ($files as $file) {
             //$rights = array_add($rights, 'documents'. $i, 'max:8000');
             $messages['documents.' . $i . '.max'] = 'Розмір файлу «' . $file->getClientOriginalName() . '» перевищує достустимый (8 мб).';
             $rights['documents.' . $i] = 'max:8000';
             $i++;
         }
     }
     // Выполняем валидацию
     $validator = Validator::make($request->all(), $rights, $messages);
     // При обнаружении ошибки - возвращаем пользователя на предыдущую страницу и выводим ошибки
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator->errors());
     }
     /*
      * Обновление информации о лоте
      */
     $create = Auction::where('id', '=', $id)->with('bidders')->first();
     $create->title = $request->lot_title;
     $create->category = $request->lot_category;
     $create->lot_type = $request->lot_type;
     $this->getAddFieldsListCategory($request->lot_category, $create, $request);
     $create->more_information = $request->more_information;
     // Додаткові відомості
     $create->more_about = $request->more_about;
     // Відомості про майно, його склад, характеристики, опис
     $create->region = $request->region;
     // Область
     $create->city = $request->city;
     // Місцезнаходження
     $create->property_type = $request->property_type;
     // Тип майна
     $create->currency = $request->currency;
     // Валюта
     if ($request->lot_image) {
         $create->img = $request->lot_image;
         $create->img_min = $request->lot_image_min;
     } else {
         $create->img = "http://uace.com.ua/static/images/no-picture-max.jpg";
         $create->img_min = "http://uace.com.ua/static/images/no-picture-min.jpg";
     }
     // Если есть основная фотография
     if ($request->lot_image) {
         $create->img = $request->lot_image;
         $create->img_min = $request->lot_image_min;
     } else {
         // Если нет, ставим стандартные
         $create->img = "http://uace.com.ua/static/images/no-picture-max.jpg";
         $create->img_min = "http://uace.com.ua/static/images/no-picture-min.jpg";
     }
     // Если установлен флажок на "Свободная продажа"
     if ($request->free_sale) {
         $create->free_sale = 1;
         // Помечаем как свободно продаваемый объект
         // Если установлен флажок на "Ціна договірна"
         if ($request->negotiable_price) {
             $create->negotiable_price = 1;
             $create->starting_price = null;
         } else {
             // В противном случае записываем введенную цену
             $create->starting_price = str_replace(" ", "", $request->starting_price);
             $create->negotiable_price = null;
         }
         $create->data_start = null;
         // Записываем дату начала
         $create->date_end = null;
         // Записываем дату завершения
         $create->guarantee_fee = null;
         // Гарантийный взнос
         $create->bid_price = null;
         // Стоимость шага
     } else {
         $create->free_sale = null;
     }
     // Если добавлен предмет на аукцион
     if (!$request->free_sale) {
         $create->free_sale = null;
         // Помечаем, что это не свободная продажа
         $create->data_start = Carbon::parse($request->data_start)->format('Y-m-d H:i');
         // Записываем дату начала
         $create->date_end = Carbon::parse($request->date_end)->format('Y-m-d H:i');
         // Записываем дату завершения
         $create->guarantee_fee = str_replace(" ", "", $request->guarantee_fee);
         // Гарантийный взнос
         $create->starting_price = str_replace(" ", "", $request->starting_price);
         // Стартовую цену
         $create->bid_price = str_replace(" ", "", $request->bid_price);
         // Стоимость шага
     }
     // Если установлен флажок на "Можливий торг"
     if ($request->possible_bargain) {
         $create->possible_bargain = 1;
     } else {
         $create->possible_bargain = null;
     }
     // Если выбран статус Архив
     if ($request->in_archive) {
         $create->in_archive = 1;
         $create->save();
     } else {
         $create->in_archive = 0;
         $create->save();
     }
     if ($create->status === $request->status) {
         $create->status = $request->status;
         $create->save();
     } elseif (!$create->free_sale && $request->status == 2) {
         $this->sendNotificationToUser($create->user, 3, 'default', $create->id, $create->title);
         // Отправка оповещения владельцу
         $create->status = 2;
         $create->save();
     } elseif (!$create->free_sale && $request->status == 3) {
         $this->sendNotificationAllBidders($create->id, $create->title, $create->bidders);
         // Отправка оповещения всем допущенным участникам
         $create->status = 3;
         $create->save();
     } elseif ($create->free_sale && $request->status == 3 || $create->free_sale && $request->status == 5 || $create->free_sale && $request->status == 7) {
         $this->sendNotificationToUser($create->user, $request->status, 'free', $create->id, $create->title);
         if ($request->status == 7) {
             $create->in_archive = 1;
             // Помещаем аукцион в Архив
         } elseif ($request->status == 3) {
             $create->in_archive = 0;
         }
         $create->status = $request->status;
         $create->save();
     } elseif (!$create->free_sale && $request->status == 7) {
         $user = App\User::find($create->user);
         // Информация о создателе аукциона
         $win = App\Bets::where('auction_id', '=', $create->id)->orderBy('created_at', 'desc')->first();
         // Определение победителя
         $create->in_archive = 1;
         // Помещаем аукцион в Архив
         if ($win) {
             $win_user = App\User::find($win->user_id);
             // Информация о победителе
             $win_status = App\Bidders::where('auction_id', '=', $create->id)->where('user_id', '=', $win->user_id)->first();
             $win_status->status = 2;
             $win_status->save();
             $create->final_price = $win->bet;
             $create->status = 7;
             // Смена статуса на "Торги відбулися"
             $create->save();
             // Отправка письма создателю аукциона
             Mail::queue('emails.auction-end', ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'middle_name' => $user->middle_name, 'auction_id' => $create->id, 'auction_cyr' => $create->currency, 'auction_title' => $create->title, 'auction_status' => 7, 'win_first_name' => $win_user->first_name, 'win_last_name' => $win_user->last_name, 'win_middle_name' => $win_user->middle_name, 'win_email' => $win_user->email, 'win_phone' => $win_user->phone, 'win_cost' => $win->bet], function ($message) use($user) {
                 $message->to($user->email, $user->first_name . ' ' . $user->last_name)->subject('Аукціон завершено');
             });
             // Отправка письма победителю аукциона
             Mail::queue('emails.auction-end-winner', ['first_name' => $win_user->first_name, 'last_name' => $win_user->last_name, 'auction_id' => $create->id, 'auction_title' => $create->title, 'auction_status' => 7, 'win_cost' => $win->bet], function ($message) use($win_user) {
                 $message->to($win_user->email, $win_user->first_name . ' ' . $win_user->last_name)->subject('Аукціон завершено');
             });
             // Отправка письма администратору
             $adminEmail = $this->globalSiteSettings['admin_email'];
             Mail::queue('emails.auction-end-admin', ['auction_id' => $create->id, 'auction_title' => $create->title, 'auction_status' => 7, 'win_first_name' => $win_user->first_name, 'win_last_name' => $win_user->last_name, 'win_middle_name' => $win_user->middle_name, 'win_email' => $win_user->email, 'win_phone' => $win_user->phone, 'win_cost' => $win->bet], function ($message) use($adminEmail) {
                 $message->to($adminEmail)->subject('Аукціон завершено');
             });
         } else {
             $create->status = 8;
             // Смена статуса на "Торги не відбулися"
             $create->save();
             // Отправка письма создателю аукциона
             Mail::queue('emails.auction-end', ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'middle_name' => $user->middle_name, 'auction_id' => $create->id, 'auction_title' => $create->title, 'auction_status' => 8], function ($message) use($user) {
                 $message->to($user->email, $user->first_name . ' ' . $user->last_name)->subject('Аукціон завершено');
             });
             // Отправка письма администратору
             $adminEmail = $this->globalSiteSettings['admin_email'];
             Mail::queue('emails.auction-end-admin', ['auction_id' => $create->id, 'auction_title' => $create->title, 'auction_status' => 8], function ($message) use($adminEmail) {
                 $message->to($adminEmail)->subject('Аукціон завершено');
             });
         }
     } else {
         $create->status = $request->status;
         $create->save();
     }
     if ($request->more_images) {
         $attaches = App\Uploads::find($request->more_images);
         foreach ($attaches as $attach) {
             $attach->auction_id = $create->id;
             $attach->type = 'image';
             $attach->save();
         }
     }
     if ($request->hasFile('documents')) {
         $files = $request->file('documents');
         foreach ($files as $file) {
             $surl = $this->globalSiteSettings['site_url'];
             $filename = preg_replace('/.[^.]*$/', '', $file->getClientOriginalName());
             $filename = $filename . '-' . mt_rand(10, 100) . '.' . $file->getClientOriginalExtension();
             $genLink = $surl . '/uploads/docs/' . $filename;
             // Генерируем ссылку
             $file->move(public_path() . '/uploads/docs/', $filename);
             // Перемещаем файл
             $upload = new App\Uploads();
             // Создаем экземпляр модели
             $upload->type = 'doc';
             // Задаем тип экземпляра - документ
             $upload->link = $genLink;
             // Записываем сгенерированную ранее ссылку
             $upload->name = preg_replace('/.[^.]*$/', '', $file->getClientOriginalName());
             // Записываем имя
             $upload->auction_id = $create->id;
             // Записываем сгенерированную ранее ссылку
             $upload->save();
             // Сохраняем
         }
     }
     // Сбрасываем закешированные данные виджета "Останні надходження"
     if (Cache::has('last_lots')) {
         Cache::forget('last_lots');
     }
     return redirect('/dashboard/auctions');
 }
예제 #16
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $cat = Cat::findOrFail($id);
     $cat->delete();
     return redirect('/admin/cat')->withSuccess("The '{$cat->name}' category has been deleted.");
 }
예제 #17
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $listArray = ['' => 'دســـته را انتخاب کنید'] + Cat::lists('title', 'id')->toArray();
     $products = Product::orderBy('id', 'desc')->paginate(10);
     return view()->make('admin.addproduct', compact('listArray', 'products'));
 }
 public function deleteCategory($id)
 {
     $cat = Cat::find($id);
     $cat->delete();
 }
예제 #19
0
 /**
  * 获取所有分类
  */
 public function allCats(Request $request)
 {
     $params = $request->get('q');
     $datas = Cat::select(['id', 'title'])->where('title', 'like', '%' . $params . '%')->get();
     return response()->json($datas);
 }
예제 #20
0
 public function showSerialsList(Article $article, $slug)
 {
     $catName = Cat::select('name')->where('slug', $slug)->take(1)->get();
     $movies = $article->select('title', 'img', 'head', 'body', 'slug')->bycatslug($slug)->language()->published()->latest()->take(get_setting('pagination_num'))->get();
     return view('components.lists.serials', compact('movies', 'catName'));
 }
예제 #21
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $biz = Biz::findorFail($id);
     $cat = $biz->cats->lists('id')->all();
     $sub = $biz->subcats->lists('id')->all();
     // dd($sub);
     $catList = Cat::lists('name', 'id');
     $subList = SubCat::lists('name', 'id');
     // dd($subList);
     $stateList = State::lists('name', 'id');
     $lgaList = Lga::lists('name', 'id');
     //$area= Address::lists
     //dd($biz->address->state->name);
     //  foreach ($biz->subcats as $sub) {
     //      $currentSubs[] = $sub->id;
     //  }
     //   if(empty($currentSubs)){
     //      $currentSubs = '';
     //  }
     return view('admin/biz/edit', compact('biz', 'catList', 'subList', 'stateList', 'cat', 'currentSubs', 'lgaList', 'sub'));
 }
예제 #22
0
 /**
  * Отображает страницу с картой сайта
  *
  */
 public function getSitemapPage(Request $request)
 {
     $cats = Cache::remember('cats', 10, function () {
         return Cat::roots()->get();
     });
     $pages = Pages::all();
     $news = Cache::remember('news_sitemap', 3600, function () {
         $news = News::where('date_publish', '<=', Carbon::parse(Carbon::now())->format('Y-m-d H:i'))->where('category', '=', 0)->get();
         return $news;
     });
     $ogoloshenia = News::where('date_publish', '<=', Carbon::parse(Carbon::now())->format('Y-m-d H:i'))->where('category', '=', 1)->get();
     return view('auction.sitemap', ['categories' => $cats, 'currentCategory' => null, 'request' => $request, 'pages' => $pages, 'news' => $news, 'ogoloshenia' => $ogoloshenia]);
 }
예제 #23
0
 public function destroy(Cat $cat)
 {
     $cat->delete();
     return redirect()->route('admin.cat.index')->with('success', 'دسته با موفقیت حذف شد.');
 }
예제 #24
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($id, Request $request)
 {
     $auctions = Auction::query();
     $auctions = $auctions->where('category', '=', $id);
     $auctions = $auctions->where('status', '>', 0);
     if ($request->sortBy == 'lowcost') {
         $auctions = $auctions->orderBy('starting_price', 'asc');
     } elseif ($request->sortBy == 'topcost') {
         $auctions = $auctions->orderBy('starting_price', 'desc');
     } elseif ($request->sortBy == 'new') {
         $auctions = $auctions->orderBy('created_at', 'desc');
     } elseif ($request->sortBy == 'new') {
         $auctions = $auctions->orderBy('created_at', 'desc');
     } else {
         $request->sortBy = 'new';
         $auctions = $auctions->orderBy('created_at', 'desc');
     }
     if ($request->items_per_page) {
         $auctions = $auctions->paginate($request->items_per_page);
     } else {
         $auctions = $auctions->paginate(10);
     }
     $categories = Cat::roots()->get();
     $currentCategory = Cat::find($id);
     return view('auction.categories.index', ['auctions' => $auctions, 'categories' => $categories, 'currentCategory' => $currentCategory, 'request' => $request]);
 }
예제 #25
0
 public function createTask()
 {
     $cats = Cat::where('catStatus', 1)->get();
     return view('admin.task.createTask')->with('cats', $cats);
 }
예제 #26
0
 public function sort(Request $request, $id)
 {
     Cache::forget('cats');
     $data = $request->input('sort');
     Cat::findOrFail($id)->update(['sort' => $data]);
     return trans('sections.sort_section') . ' #' . $id . ' ' . trans('sections.sort_changed') . ' ' . $data . ' ' . trans('sections.sort_position');
 }
예제 #27
0
                <th>ID</th>
                <th width="300">Заголовок</th>
                <th>Категорія</th>
                <th>Місцезнаходження</th>
                <th>Статус</th>
                <th>Ціна</th>
                <th>Користувач</th>
                <th>Дата аукціону</th>
                <th>Дата додавання</th>
                <th></th>
            </tr>
            </thead>
            <tbody>

            <?php 
$cats = \App\Cat::all();
?>

            @foreach($auctions as $auction)
                <tr>
                    <td>{{ $auction->id }}</td>
                    <td>{{ $auction->title }}</td>
                    <td>{{ $cats->find($auction->category)->name }}</td>
                    <td>{{ trans('theme.regions.'. $auction->region) }}@if($auction->city), {{ $auction->city }} @endif</td>
                    <td>
                        @if($auction->free_sale)
                            <span @if($auction->status == 0)style="color: red" @endif>{{ trans('theme.statuses_free.'. $auction->status) }}</span>
                        @else
                            <span @if($auction->status == 0)style="color: red" @endif>{{ trans('theme.statuses.'. $auction->status) }}</span>
                        @endif
                    </td>
예제 #28
0
 public function profile($userId)
 {
     $cats = Cat::all();
     $user = \App\User::findOrFail($userId);
     $bizs = $user->favours;
     $favourites = \DB::table('favourites')->whereUserId(\Auth::user()->id)->lists('biz_id');
     //$bizs = Biz::orderBy('created_at', 'desc')->paginate(6);
     $stateList = State::lists('name', 'name');
     $lgaList = Lga::lists('name', 'id');
     $catList = Cat::lists('name', 'name');
     $featured = Biz::whereFeatured('YES')->paginate(3);
     $recent = Biz::orderBy('created_at', 'desc')->paginate(2);
     // dd($featured);
     return view('pages.user-profile', compact('stateList', 'lgaList', 'catList', 'cats', 'bizs', 'user', 'favourites', 'featured', 'recent', 'totalBiz', 'totalCat'));
 }
예제 #29
0
        <div class="col-xs-12 col-md-6">

            <div class="form-group @if($errors->has('lot_title'))has-error @endif">
                <label for="lot_title">Назва лоту <span class="label-required">*</span></label>
                <input type="text" name="lot_title" class="form-control input-lg" id="lot_title" placeholder="" value="{{{ old('lot_title') }}}">
            </div>

        </div>
        <div class="col-xs-12 col-md-6">

            <div class="form-group @if($errors->has('lot_category'))has-error @endif">
                <label for="lot_category">Категорія лоту <span class="label-required">*</span></label>
                <select id="SelectCategory" class="form-control input-lg" name="lot_category">
                    <option value>Не обрано</option>
                    <?php 
$cats = \App\Cat::roots()->get();
?>
                    @foreach($cats as $category)
                        <option @if(old('lot_category') == $category->id)selected @endif value="{{ $category->id }}">{{ $category->name }}</option>
                    @endforeach
                </select>
            </div>

        </div>
    </div>

    <div class="row load_children" style="display: none">
        <div class="col-xs-12">
            <div class="form-group @if($errors->has('lot_type'))has-error @endif">
                <div id="loadChildren"></div>
            </div>
예제 #30
0
 public function edit(Post $post)
 {
     $cats = Cat::orderBy('parent', 'asc')->get();
     return view('posts.edit', compact('post', 'cats'));
 }