Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
How to return a string that only has a special value of text that has been set?

enter image description here

I have data like the image above. However, in the "Bahan-bahan" column, I only want to display the values ​​in the predefined custom values ​​below.

<?php 

return [
    'shopping_list' => [
            '1' => 'Ikan Bawal',
            '2' => 'Udang Segar',
            '3' => 'Daging Ayam',
            '4' => 'Daging Sapi',
        ],
    ];

?>

How to make this using PHP Laravel or javascript?

Following this, the code I have created using Laravel 7.

public function index(Request $request)
{
    $payment_method = PaymentMethod::Where('payment_type', 1)->get();
    if (request()->ajax()) {

        $category = Category::find(6);

        $orders = $category->products()
        ->withCount([
            'orderSummaries as order_count' => function ($query) {
                $query->whereHas('order', function (Builder $query) {
                    $query->where('order_status', 2);
                });
            }
        ])
        ->whereHas('orderSummaries', function (Builder $query) {
            $query->whereHas('order', function (Builder $query) {
                $query->where('order_status', 2);
            });
        })
        ->get();

        return DataTables::of($orders)
            ->addIndexColumn()
            ->editColumn('ingredient', function($item) {
                $text = \Str::between($item->description, 'Bahan-bahan:','Cara Membuat');

                return nl2br($text);
            })
            ->rawColumns(['name','order_count', 'ingredient'])
            ->make(true);
    }
    return view('admin.marketplace.shoppingList.index',[
        'title'          => 'Belanja',
        'subtitle'       => 'Daftar Belanja',
        'payment_method' => $payment_method,
    ]);
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda