Any know issues especially around browser compatibility for React or Vue apps created using Vite instead of the old CRA and Vue CLI?

|
Sona S Vimal 2021-12-06 05:36:30
How to send a Json file contents in api response with metadata and links in laravel?
Kapil Sharma 2021-12-06 07:27:58
neelbas 2021-12-06 01:34:23
Hi, I have Bill model, it has Many BillLines and each BillLine has one-to-one relation to Products
so BillLine table has bill_id, product_id colums as foreign keys.
How I can get a Bill with it’s BillLines contains Product ?

I tried (from Bill model) :
public function products(): HasManyThrough {
return $this->hasManyThrough(Product::class, BillLine::class);
}
but it throw error which mean ‘products.bill_line_id’ is require, but in my design the product table can’t be contains bill_line column!

There is another parameter for hasmanythrough where you can define foreign key check docs

themanojyadav 2021-12-06 10:37:40
anyone know how to get value of this param from the url http://127.0.0.1:8000/survey/complete/pid=12354/uid=1232
HamidRoohani 2021-12-06 11:07:34
themanojyadav 2021-12-06 10:37:40
anyone know how to get value of this param from the url http://127.0.0.1:8000/survey/complete/pid=12354/uid=1232

request()->get(‘pid’);

themanojyadav 2021-12-06 11:10:02
HamidRoohani 2021-12-06 11:07:34
request()->get(‘pid’);

Thanks brother

HamidRoohani 2021-12-06 11:10:39
themanojyadav 2021-12-06 11:10:02
Thanks brother

welcome

2021-12-06 11:11:01
Sona S Vimal 2021-12-06 05:36:30
How to send a Json file contents in api response with metadata and links in laravel?

return response()–>json([‘code’=>’1’])

unname 2021-12-06 13:45:37
Hi everyone I want a help .. in laravel I have just started ..
unname 2021-12-06 13:47:09
my controller class is not define this error i am getting
WaseemBittu 2021-12-06 14:08:06
unname 2021-12-06 13:47:09
my controller class is not define this error i am getting

U need to create a controller

unname 2021-12-06 14:38:02
Yes yes i have created and wrote a function as well
danielwaiguru 2021-12-06 14:38:37
unname 2021-12-06 14:38:02
Yes yes i have created and wrote a function as well

Import the controller then

unname 2021-12-06 14:53:36
where in route ?
unname 2021-12-06 14:54:00
means in web.php
bryan_king 2021-12-06 15:41:07
unname 2021-12-06 13:47:09
my controller class is not define this error i am getting

How are u defining the routes with the controller

skpnation 2021-12-06 16:47:51
Please who has a solution?
skpnation 2021-12-06 16:48:29
skpnation 2021-12-06 16:47:51
Please who has a solution?

json_decode(): Argument #1 ($json) must be of type string, array given

skpnation 2021-12-06 16:48:56
skpnation 2021-12-06 16:48:29
json_decode(): Argument #1 ($json) must be of type string, array given

This is the cause $dataString = json_decode($data);
how can it be fixed?

sbruder 2021-12-06 16:49:42
your line of code looks wrong, if you are getting an array and expects as a result a string, probably you want to *encode*, and not decode?
sbruder 2021-12-06 16:51:05
encode: pass an array / object and receive string representation
decode: pass a string repr. and gets the equivalent array/obj representation.
skpnation 2021-12-06 16:51:43
sbruder 2021-12-06 16:51:05
encode: pass an array / object and receive string representation
decode: pass a string repr. and gets the equivalent array/obj representation.

can you send me a sample?

bjvalmaseda 2021-12-06 17:01:13
laravel_discuss-101531.jpg

bjvalmaseda 2021-12-06 17:01:38
bjvalmaseda 2021-12-06 17:01:13

One tipπŸ‘†

sbruder 2021-12-06 17:05:58
skpnation 2021-12-06 16:51:43
can you send me a sample?

what do you want to do, encode a json string or get a json and get the equivalent variable?

skpnation 2021-12-06 17:11:05
laravel_discuss-101534.jpg
here’s what I’m trying to do
skpnation 2021-12-06 17:11:45
This wasn’t working $dataString = json_decode($data);
skpnation 2021-12-06 17:11:57
So I used $dataString = json_decode(json_encode($data),true);
skpnation 2021-12-06 17:12:13
But still getting an error
natghi2010 2021-12-06 17:42:01
anyone know a quick way to remove duplicates from an associative array in laravel?
thekiharani 2021-12-06 17:43:41
Any know issues especially around browser compatibility for React or Vue apps created using Vite instead of the old CRA and Vue CLI?
sbruder 2021-12-06 17:45:18
skpnation 2021-12-06 17:12:13
But still getting an error

if you are sending to a request made by CURL you want to encode it.

sbruder 2021-12-06 17:46:44
try to understand what you need and what those functions do, the answer will be obvious.
skpnation 2021-12-06 17:53:37
sbruder 2021-12-06 17:46:44
try to understand what you need and what those functions do, the answer will be obvious.

I’m trying to send an fcm push notfication

unname 2021-12-06 17:56:50
bryan_king 2021-12-06 15:41:07
How are u defining the routes with the controller

By using get method ..

sbruder 2021-12-06 17:57:46
you need to $dataString = json_encode($data);
|