Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
¿Cómo devolver una cadena que solo tiene un valor especial de texto que se ha establecido?

ingrese la descripción de la imagen aquí

Tengo datos como la imagen de arriba. Sin embargo, en la columna "Bahan-bahan", solo quiero mostrar los valores en los valores personalizados predefinidos a continuación.

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

¿Cómo hacer esto usando PHP Laravel o javascript?

A continuación, el código que he creado usando 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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!