Category : json

im facing an issue to retrive an array from my database and display it on my blade. So to understand my work, im actualy saving "Cart" informations on my "Orders Table" with Serialize the Products public function store(Request $request) { $order = new Order(); $order->user_id = request(‘user_id’); $order->wilaya = request(‘wilaya’); $order->province = request(‘province’); $order->address = ..

Read more

I have a Laravel 8 application where I want to test a part of the JSON that’s returned from an HTTP API call. My response object looks like the following: { "data": [ { "name": "Cumque ex quos.", "createdAt": "2020-12-29T17:15:32.000000Z", "updatedAt": "2020-12-29T17:15:32.000000Z", "startAt": "2021-01-18 17:15:32", "endAt": "2021-01-18 17:15:32", "startedAt": null, "status": "Running", "range": { "type": ..

Read more

I have a Laravel 8 application where I want to test a part of the JSON that’s returned from an HTTP API call. My response object looks like the following: { "data": [ { "name": "Cumque ex quos.", "createdAt": "2020-12-29T17:15:32.000000Z", "updatedAt": "2020-12-29T17:15:32.000000Z", "startAt": "2021-01-18 17:15:32", "endAt": "2021-01-18 17:15:32", "startedAt": null, "status": "Running", "range": { "type": ..

Read more

I got this array of objects: $table = [ { active: 1, chart_html: "<div>Some html code…</div>", collections: ["172173426824", "172173492360"], conditions: 0, created_at: "2020-12-21 17:03:43", id: 13, layout: "20", metric: "cm", productTags: ["adidas", "backpack"], productTypes: ["ACCESSORIES", "SHOES"], productVendors: ["ASICS TIGER", "DR MARTENS", "FLEX FIT"], products: ["4632300454024", "4632300912776"], shop_id: 4, title: "Chart 7", updated_at: "2020-12-21 17:03:43" }, ..

Read more

I got this array of objects: $table = [ { active: 1, chart_html: "<div>Some html code…</div>", collections: ["172173426824", "172173492360"], conditions: 0, created_at: "2020-12-21 17:03:43", id: 13, layout: "20", metric: "cm", productTags: ["adidas", "backpack"], productTypes: ["ACCESSORIES", "SHOES"], productVendors: ["ASICS TIGER", "DR MARTENS", "FLEX FIT"], products: ["4632300454024", "4632300912776"], shop_id: 4, title: "Chart 7", updated_at: "2020-12-21 17:03:43" }, ..

Read more

i´m traying to send a form with ajax, but always returned me this error: contact:1 Uncaught SyntaxError: Unexpected token C in JSON at position 0 i don´t know what i´m doing wrong, but i can´t solve my problem. I attach my actual html al js. html <form class="custom-form" name="contactform" id="contactform" method="POST" action="{{ url(‘sendContactForm’) }}" data-type="json"> ..

Read more

I´m trying to send a form with AJAX, but it always returns me this error: contact:1 Uncaught SyntaxError: Unexpected token C in JSON at position 0 I don´t know what I´m doing wrong and I can’t solve my problem. I attach my actual HTML and JS. HTML <form class="custom-form" name="contactform" id="contactform" method="POST" action="{{ url(‘sendContactForm’) }}" ..

Read more

when show the data coming through Laravel translatable , the functionality of quick search on table stops working with that columns have arabic and english values (json). EX. datatable method : { $dataTable = new EloquentDataTable($query); return $dataTable->addColumn(‘action’, ‘permit::datatable.actions’) ->addColumn(‘permit_name’, function($q){ return substr( $q->permit_name ,’0′,’100′) . ‘…’; }) ->addColumn(‘permit_name_ar’, function($q){ return substr($q->getTranslation(‘permit_name’,’ar’) ,’0′,’100′) . ‘…’ ..

Read more

Structure "expenses_column": { "28": { "name": "account.payroll" }, "36": { "name": "account.marketing_and_distribution" }, "29": { "name": "account.general" }, } How could I make it "expenses_column": [ "28": { "name": "account.payroll" }, "36": { "name": "account.marketing_and_distribution" }, "29": { "name": "account.general" }, ] The response structure is a JSON format however my code structure already is ..

Read more

I’m trying to build the following query Model::where(‘id’,$id)->groupBy(‘type’)->get(); I get the following error: SELECT list is not in GROUP BY clause and contains nonaggregated column ‘db.table.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group This is the result without group by, i’m trying to group by type ..

Read more

I’m going to use json_decode. I’m trying to make JSON string. If I put it in a variable, the string will be escaped like following. "{ "id": {"value": "hoge"}}" It returns null, when I use. json_decode("{ "id": {"value": "hoge"}}") I would like to make following string. json_decode(‘{ "id": {"value": "hoge"}}’) Please let me know how ..

Read more

In Laravel, I have the following relationships between 4 models named LevelOne, LevelTwo, LevelThree and LevelFour: //LevelOne Model public function levelTwo(){ return $this->hasMany(LevelTwo::class); } //LevelTwo Model public function levelOne(){ return $this->belongsTo(LevelOne::class); } public function levelThree(){ return $this->hasMany(LevelThree::class); } //LevelThree Model public function levelThree(){ return $this->belongsTo(LevelThree::class); } public function levelFour(){ return $this->hasOne(LevelFour::class); } //LevelFour Model public ..

Read more

When I show decode item that in value tag, so I get the item before space not get full value. <?php $ad = $quiz[‘options’]; $explode = json_decode($ad, true); ?> <input type="text" class="form-control mb-1" name="options[]" required placeholder="option{{ $i+1 }}" value = {{$explode[$i]}}/> With code result But actual result is carbon dioxide DD result Sourc..

Read more

Im fetching data from two tables using join , however, i want my result to return a multi-dimensional array , i.e , FRUITS Apple Mango Orange Animal Dog Cat Cow Country Germany UK USA so, that is what i want it to return ,see my code below Route::get(‘all-category’, function(){ $category = DB::table(‘directory_companies’) ->join(‘categories’,’directory_companies.categories_id’, ‘=’, ‘categories.id’) ..

Read more