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]); }
/** * @return string */ public function render() { $model = $this->form->instance; $formats = []; foreach (Models\Format::get() as $format) { $formats[$format->id] = $format->width . 'x' . $format->height; } $photos = []; $itemsAddons = []; $itemsField = []; foreach ($model->items()->get() as $key => $item) { $itemsField[$key] = [HtmlBuilder::text('items[' . $key . '][qty]', 'Qty', $item->qty, ['data-parsley-required' => true, 'data-parsley-type' => 'number', 'data-parsley-min' => '1']), HtmlBuilder::text('items[' . $key . '][price_per_item]', 'Price per item', $item->price_per_item, ['data-parsley-required' => true, 'data-parsley-type' => 'number']), HtmlBuilder::select('items[' . $key . '][format_id]', 'Format', $formats, $item->format_id, ['data-parsley-required' => true]), $this->formBuilder->hidden('items[' . $key . '][photo_id]', $item->photo_id, ['data-parsley-required' => true])]; $photos[$key] = $item->photo()->first(); foreach ($item->ordersItemsAddons()->get() as $ordersItemsAddon) { $itemsAddons[$key][$ordersItemsAddon->addon_id] = $ordersItemsAddon->qty; } } return view('admin/form/order/items')->with('label', $this->label)->with('itemsField', $itemsField)->with('photos', $photos)->with('addons', Models\Addon::get())->with('itemsAddons', $itemsAddons); }
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')]); }
<input type='hidden' name="format[]" class="book-format"> <div class="progress"> <div class="progress-bar" role="progressbar" style="width: 0%;"> 0% </div> </div> <button type="button" class="btn btn-default delete-file">Delete</button> </div> <div class="col-lg-4 row"> <div class="col-lg-7"> <select class="selectpicker format form-control" data-live-search="true"> <option class="hide empty" selected value="">--</option> <?php $rows = Format::find()->all(); ?> <?php foreach ($rows as $row) { ?> <option value="<?php echo $row->id; ?> "> <?php echo $row->name; ?> </option> <?php } ?>
/** * @return \yii\db\ActiveQuery */ public function getBookFormats() { return $this->hasMany(Format::className(), ['id' => 'formatId'])->viaTable('book_format', ['bookId' => 'id']); }
/** * Displays a single Product model. * @param integer $id * @return mixed */ public function actionView($id) { // Получить продукт $product = $this->findModel($id); return $this->render('view', ['product' => $product, 'product_group_products' => $product->getGroupProducts(), 'product_brand' => Brand::getBrand($product->getBrandID()), 'product_format' => Format::getFormatByProductID($product->getProductID()), 'product_infliction' => Infliction::getInflictionByProductID($product->getProductID())]); }
public function create() { return view('create', ['genres' => Genre::all(), 'ratings' => Rating::all(), 'labels' => Label::all(), 'sounds' => Sound::all(), 'formats' => Format::all()]); }
/** * @SWG\Api( * path="/format/all", * @SWG\Operation( * nickname="Get all formats", * method="GET", * summary="Find all formats", * notes="Returns all formats", * type="array", * @SWG\Items("Format"), * authorizations={} * ) * ) */ public function all() { $statusCode = 200; $response = []; $formatModels = Models\Format::all(); foreach ($formatModels as $formatModel) { $formatView = new ModelViews\Format($formatModel); $response[] = $formatView->get(); } return \Response::json($response, $statusCode); }