Inheritance: extends Illuminate\Database\Eloquent\Model
 /**
  * Displays all closed issues.
  *
  * @return \Illuminate\View\View
  */
 public function closed()
 {
     $user = Auth::user();
     $model = $this->issue->closed();
     if ($user->cannot('manage.issues')) {
         $model = $model->forUser($user);
     }
     $issues = $this->presenter->table($model);
     $labels = $this->label->all();
     $navbar = $this->presenter->navbar($labels);
     return view('pages.issues.index', compact('issues', 'navbar'));
 }
Exemple #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $colors = Label::getColors();
     $labels = [['name' => 'Duplicate', 'color' => $colors['default']], ['name' => 'In Progress', 'color' => $colors['info']], ['name' => 'Question', 'color' => $colors['info']], ['name' => 'Working on it', 'color' => $colors['warning']], ['name' => 'Bug', 'color' => $colors['danger']], ['name' => 'Critical', 'color' => $colors['danger']]];
     foreach ($labels as $label) {
         Label::firstOrCreate($label);
     }
 }
Exemple #3
0
 public function create()
 {
     $formats = Format::all();
     $genres = Genre::all();
     $labels = Label::all();
     $ratings = Rating::all();
     $sounds = Sound::all();
     return view('create', ['formats' => $formats, 'labels' => $labels, 'genres' => $genres, 'ratings' => $ratings, 'sounds' => $sounds]);
 }
 /**
  * Deletes the specified label.
  *
  * @param int|string $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     $label = $this->label->findOrFail($id);
     if ($label->delete()) {
         flash()->success('Success!', 'Successfully deleted label.');
         return redirect()->route('labels.index');
     }
     flash()->error('Error!', 'There was a problem deleting this label. Please try again.');
     return redirect()->route('labels.edit', [$id]);
 }
 public function buildIndex($type = false, $type_id = false, $chain = false, $strSearch = false, $provider_id = false, $brand_id = false)
 {
     $purchaseModel = new Purchase();
     $labelModel = new Label();
     $userModel = new User();
     $count = $this->_glob['_countProductsOfPage'];
     if (isset($_GET['show']) and $_GET['show'] == 'all') {
         $count = $this->_glob['_maxCountProductsOfPage'];
     }
     $purchases = $purchaseModel->getPurchases($type, $type_id, $strSearch, $count, $provider_id, $brand_id);
     $productsIds = $purchases->pluck('product_id');
     $productsIds = $productsIds->toArray();
     $labels = $labelModel->getLabelsByProductsId($productsIds);
     foreach ($purchases as $purchase) {
         $purchase->zakup = $this->getRub($purchase->base_price * ((100 - $purchase->discount_price) / 100) * ($this->_glob['_curr'][$purchase->currency]['RATE'] * ((100 + $purchase->raise) / 100)) * ((100 - $purchase->discount_bulk) / 100), $purchase->currency);
         //та самая ебанутая формула расчета закупа
         if (count($labels) > 0) {
             $arLabel = [];
             foreach ($labels as $label) {
                 if ($purchase->product_id == $label->product_id) {
                     $arLabel[] = $label;
                 }
             }
             $purchase->labels = $arLabel;
         }
     }
     $userTemplates = $userModel->getTemplates('purchases');
     $serializeFields = $userModel->getFields(Auth::User()->template_purch_id, 'purchases');
     $showFields = false;
     if ($serializeFields != null) {
         $showFields = unserialize($serializeFields->fields);
     }
     $pathToProduct = '/product';
     if ($type == 'category') {
         $pathToProduct = '/product/category/' . $type_id[0];
     }
     if ($type == 'brand') {
         $pathToProduct = '/product/brand/' . $type_id;
     }
     if ($type == 'product') {
         $pathToProduct = '/product/product/' . $type_id;
     }
     if ($type == 'label') {
         $pathToProduct = '/product/label/' . $type_id;
     }
     if ($type == 'flag') {
         $pathToProduct = '/product/flag/';
     }
     if ($strSearch) {
         $pathToProduct = '/product/search/' . $strSearch;
     }
     return view('purchases.index')->with('title', 'Условия и цены')->with('purchases', $purchases)->with('chain', $chain)->with('pathToProduct', $pathToProduct)->with('templates', $userTemplates)->with('fields', $showFields);
 }
Exemple #6
0
 /**
  * Persist the changes.
  *
  * @param Label $label
  *
  * @return bool
  */
 public function persist(Label $label)
 {
     $label->name = $this->input('name', $label->name);
     $label->color = $this->input('color', $label->color);
     return $label->save();
 }
 public function insertdvd(Request $request)
 {
     $format_id = $request->input('format');
     $genre_id = $request->input('genre');
     $label_id = $request->input('label');
     $rating_id = $request->input('rating');
     $sound_id = $request->input('sound');
     $title = $request->input('title');
     $validator = Validator::make($request->all(), ['title' => 'required|min:5']);
     if ($validator->fails()) {
         return redirect("/dvds/create")->withErrors($validator)->withInput();
     }
     $dvd = new DVD();
     $dvd->title = $title;
     $dvd->format_id = $format_id;
     $dvd->genre_id = $genre_id;
     $dvd->label_id = $label_id;
     $dvd->rating_id = $rating_id;
     $dvd->sound_id = $sound_id;
     $dvd->save();
     $request->session()->flash('success', 'DVD successfully added!');
     $formats = Format::all();
     $genres = Genre::all();
     $labels = Label::all();
     $ratings = Rating::all();
     $sounds = Sound::all();
     return view('create', ['formats' => $formats, 'genres' => $genres, 'labels' => $labels, 'ratings' => $ratings, 'sounds' => $sounds, 'success' => $request->session()->get('success')]);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Label $labelModel, History $historyModel, Purchase $purchaseModel, Provider $providerController, Brand $brandModel, Category $categoryModel, Product $productModel, $id)
 {
     $product = $productModel->getProduct($id);
     if (!$product) {
         abort(404);
     }
     $purchase = $purchaseModel->getPurchase($id);
     $historyProduct = $historyModel->getProductHistory($id);
     $historyPurchase = $historyModel->getPurchaseHistory($id);
     $historySite = $historyModel->getSiteHistory($id);
     $labels = $labelModel->getLabelsByProductsId([$id]);
     $arLabels = [];
     foreach ($labels as $label) {
         $arLabels[] = $label->label;
     }
     $strLabels = implode(',', $arLabels);
     if (!empty($product->childs)) {
         $product->childs = unserialize($product->childs);
     }
     $categories_list = $categoryModel->getFullCategoriesList();
     $brands_list = $brandModel->getFullBrandsList();
     $provider_list = $providerController->getProvedrsList();
     return view('products.show')->with('title', $product->category_name . ' ' . $product->name)->with('product', $product)->with('purchase', $purchase)->with('categories_list', $categories_list)->with('brands_list', $brands_list)->with('provider_list', $provider_list)->with('history_product', $historyProduct)->with('history_purchase', $historyPurchase)->with('history_site', $historySite)->with('labels', $strLabels);
 }
 public function delete(Label $labelModel, $id)
 {
     $labelModel->deleteLabel($id);
     Session::flash('message', GetMessages("SUCCESS_DELETE_LABEL"));
     return redirect()->route('label.index');
 }
 public function create()
 {
     return view('create', ['genres' => Genre::all(), 'ratings' => Rating::all(), 'labels' => Label::all(), 'sounds' => Sound::all(), 'formats' => Format::all()]);
 }
Exemple #11
0
 /**
  * Returns a new issue labels form.
  *
  * @param Issue $issue
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function formLabels(Issue $issue)
 {
     return $this->form->of('issue.labels', function (FormGrid $form) use($issue) {
         $labels = Label::all()->pluck('display', 'id');
         $form->attributes(['method' => 'POST', 'url' => route('issues.labels.store', [$issue->id])]);
         $form->with($issue);
         $form->layout('components.form-modal');
         $form->fieldset(function (Fieldset $fieldset) use($labels) {
             $this->labelField($fieldset, $labels);
         });
         $form->submit = 'Save';
     });
 }
Exemple #12
0
});
Route::get('contactMe', function () {
    return view('contactMe');
});
Route::get('testimonials', function () {
    return view('testimonials');
});
Route::get('index', function () {
    return view('index');
});
Route::get('allPhotos', function () {
    return view('allPhotos');
});
Route::resource('posts', 'PostsController');
Route::get('labels/{id}', function ($id) {
    $label = \App\Models\Label::find($id);
    return view('label', ['label' => $label]);
});
Route::get('login', "LoginController@showLoginForm");
Route::post('login', "LoginController@processLogin");
Route::get('logout', "LoginController@logout");
Route::resource('pricingPackages', 'PackagesController');
Route::resource('comments', 'CommentsController');
Route::resource('portfolios', 'PortfolioController');
Route::post('images', function () {
    $file = Request::file("file");
    $temptID = Request::get("temp_id");
    $name = time() . $file->getClientOriginalName();
    $file->move('img', $name);
    $photo = new \App\Models\Photo();
    $photo->image = $name;
Exemple #13
0
 /**
  * Operations to run upon deleting a label.
  *
  * @param Label $label
  */
 public function deleting(Label $label)
 {
     if (!$label->deleted_at) {
         $label->issues()->detach();
     }
 }