mercredi 24 juin 2020

Search value in array in Laravel Blade

I am beginner in Laravel.

I have array in variable $selectedProductFeatures:

array:9 [▼
  0 => array:9 [▼
    "id" => 9
    "product_id" => 3
    "feature_id" => 1
    "key" => "price60"
    "description" => "60"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  1 => array:9 [▼
    "id" => 10
    "product_id" => 3
    "feature_id" => 1
    "key" => "price60_promo"
    "description" => "65"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  2 => array:9 [▼
    "id" => 11
    "product_id" => 3
    "feature_id" => 1
    "key" => "price90"
    "description" => "90"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  3 => array:9 [▼
    "id" => 12
    "product_id" => 3
    "feature_id" => 1
    "key" => "price90_promo"
    "description" => "95"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  4 => array:9 [▼
    "id" => 13
    "product_id" => 3
    "feature_id" => 1
    "key" => "countertop_length"
    "description" => "1000.00"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  5 => array:9 [▼
    "id" => 14
    "product_id" => 3
    "feature_id" => 1
    "key" => "countertop_type"
    "description" => "4"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  6 => array:9 [▼
    "id" => 15
    "product_id" => 3
    "feature_id" => 1
    "key" => "maintenance"
    "description" => "<p>konserwacja</p>"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  7 => array:9 [▼
    "id" => 16
    "product_id" => 3
    "feature_id" => 1
    "key" => "other_title"
    "description" => "tytuł inny"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
  8 => array:9 [▼
    "id" => 17
    "product_id" => 3
    "feature_id" => 1
    "key" => "other_description"
    "description" => "<p>opis inny</p>"
    "maxvalue" => "0.00"
    "minvalue" => "0.00"
    "created_at" => "2020-06-24T08:27:35.000000Z"
    "updated_at" => "2020-06-24T08:27:35.000000Z"
  ]
]

return view('admin.products.view', ['selectedProductFeatures' =>$selectedProductFeatures->toArray(), 'productTypes' => $productTypeRepository->allEnables('name', $orderBy = 'asc', $with = []), 'fileCount' => 5, 'fileFolder' => 'products', 'fileId' => $id, 'product' => $this->model->findOrFail($id), 'categories' => $categories, 'taxVat' => $vatRepository->allEnables('value', 'asc'), 'page_title' => 'Produkty', 'page_breadcrumbs' => [['page' => route('product.index'), 'title' => 'Produkty'], ['page' => '#', 'title' => 'Edytuj produkt']]]);

My blade file:

<input type="text" name="price60" value="">
<input type="text" name="price90" value="">

In price60 I need show value from array (array is dynamic).

"key" => "price60" -- this is name input "description" => "60" - this value to show.

In result I need:

For "key" => "price90" and "description" => "90" in input I need show:

<input type="text" name="price90" value="90">

How can I make it?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BE8Dg0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire