vendredi 1 octobre 2021

How to Decode Json object in laravel and apply foreach loop on that in blade file laravel5.5

I am inserting data field "data_all_tab" of children elements in json format in database. I need to decode that data and foreach loop to inside element "data_all_tab" . need to display that in blade file

public function check(Request $request,$label)
    {
        $label = Label::where("name",$label)->get();
        $types = Type::whereIn('id',$type_check)->get();
        return view('indocount.check',['label'=>$label],['types'=>$types]); 

    }

In label i am getting below output in blade file

{"id":23,"name":"TEST","image":"626547997.png","seltype":"2,5,12,13,15","created_at":"2021-10-01 17:18:49","updated_at":"2021-10-01 17:53:01","image2":"1717423306.png","banner":"1586871240.png","image3":"209824040.png","image4":"209824040.png","image5":"1097836203.png","image6":"124898669.png","data_all_tab":"{\r\n \"disableOneColumnMode\": true,\r\n \"children\": [\r\n {\r\n \"x\": 0,\r\n \"y\": 0,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"6\"\r\n },\r\n {\r\n \"x\": 0,\r\n \"y\": 4,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"1\"\r\n },\r\n {\r\n \"x\": 0,\r\n \"y\": 8,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"2\"\r\n },\r\n {\r\n \"x\": 0,\r\n \"y\": 12,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"3\"\r\n },\r\n {\r\n \"x\": 0,\r\n \"y\": 16,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"4\"\r\n },\r\n {\r\n \"x\": 0,\r\n \"y\": 20,\r\n \"w\": 12,\r\n \"h\": 4,\r\n \"content\": \"5\"\r\n }\r\n ]\r\n}"}

I want get data of "data_all_tab" of children elements inside blade and apply foreach loop then display all elements in blade file.

If anyone have idea then let me know



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire