Hi Laravel, in the model section, how does it convert an array into an object and vice versa?

|
cayetanohosma 2020-11-24 12:59:10
deel_nevis 2020-11-24 12:04:29
Hi Laravel, in the model section, how does it convert an array into an object and vice versa?

Did you read the Laravel Documentation??

Relaxed Guy 2020-11-24 13:16:27
cayetanohosma 2020-11-24 12:40:35
You should access thru the relationship name into the source table, for example if in the model you define a function User() to return the relationship, you could do $myModel::find()->User() and it return to you the related record

Thnx

deel_nevis 2020-11-24 13:21:39
cayetanohosma 2020-11-24 12:59:10
Did you read the Laravel Documentation??

Yes, I just want to know how it turns an array into an object and vice versa in the background model

Pro 2020-11-24 13:24:24
deel_nevis 2020-11-24 13:21:39
Yes, I just want to know how it turns an array into an object and vice versa in the background model

Dig deeper in the source code 🔥

deel_nevis 2020-11-24 13:37:32
Pro 2020-11-24 13:24:24
Dig deeper in the source code 🔥

$user = User::find($id);

$user[‘age];
$user->age;

In the example above, the value can be taken as an object and an array

Now we want to do the same thing for an array

2020-11-24 14:04:53
laravel_discuss-60155.jpg

2020-11-24 14:04:53
laravel_discuss-60154.jpg
Hi help me write the back end of this page which will allow you to go from the first page to the second page because I don’t know where to start. thank you
abarbodx 2020-11-24 14:12:30
princeferozepuria 2020-11-24 06:50:05
how to use queues jobs in laravel

https://laravel.com/docs/8.x/queues

2020-11-24 14:20:57
berlin5556666 2019-09-19 10:34:51
hi guys i interest work freelancer in laravel development

any one interesting to work together ?

Yes I’m

tdas97 2020-11-24 14:49:43
2020-11-24 14:04:53
Hi help me write the back end of this page which will allow you to go from the first page to the second page because I don’t know where to start. thank you

use laravel paginate so you can get the next page

Vignesh2516 2020-11-24 14:55:48
How to fix laravel white screen page issue

My index page working fine
Other pages showing blank. White screen

Vignesh2516 2020-11-24 14:55:58
Someone please help me
Jomitz 2020-11-24 15:09:51
Check you routes and response view paths
tdas97 2020-11-24 15:16:47
Vignesh2516 2020-11-24 14:55:48
How to fix laravel white screen page issue

My index page working fine
Other pages showing blank. White screen

show us your code

LambdaVector 2020-11-24 15:21:45
In DuskServiceProvider.php line 15:

Class ‘LaravelDuskBrowser’ not found

Vignesh2516 2020-11-24 15:23:06
tdas97 2020-11-24 15:16:47
show us your code

laravel_discuss-60166.jpg

Vignesh2516 2020-11-24 15:23:42
tdas97 2020-11-24 15:16:47
show us your code

laravel_discuss-60167.jpg

tdas97 2020-11-24 15:25:56
Vignesh2516 2020-11-24 15:23:06

is that route exist?

tdas97 2020-11-24 15:27:42
btw it’s better to take screenshoot it will get us easier to read your code
Jomitz 2020-11-24 16:32:54
Vignesh2516 2020-11-24 15:23:42

Show route code to this controller

berlin5556666 2020-11-24 17:13:28
Hi I looking for remote job
shaildark 2020-11-24 17:35:47
Vignesh2516 2020-11-24 15:23:42

in compact method pass variables in array like this compact([ ])

GistOf 2020-11-24 17:38:39
laravel_discuss-60177.jpg

GistOf 2020-11-24 17:42:23
shaildark 2020-11-24 17:35:47
in compact method pass variables in array like this compact([ ])

Passing variable names as shown in the pic should work too

Vignesh2516 2020-11-24 17:48:10
shaildark 2020-11-24 17:35:47
in compact method pass variables in array like this compact([ ])

OK I. Will try
Thank u very much !!

MishalLeo 2020-11-24 17:48:11
How to use multi user in livewire any please help me
alancbhn 2020-11-24 17:50:20
Hi community! I have a small question
alancbhn 2020-11-24 17:52:57
If I build a website with Laravel and in the future I want to make it a native app for Android and iOS. Should I make it again from scratch?
Bhuvi Sharma 2020-11-24 17:59:47
laravel_discuss-60184.jpg

JeevaniSM 2020-11-24 18:07:14
deel_nevis 2020-11-24 12:04:29
Hi Laravel, in the model section, how does it convert an array into an object and vice versa?

not sure about Laravel but in PHP – you can use a few options as
1. use the json encode then decode – $object = json_decode(json_encode($array,FALSE));
2. use the object cast method – $object = (object) $array ;
3. or iterate the array values to a new object stdClass
$object = new stdClass() ;
foreach($array as $key => $value )
{
$object->key =$value ;
}

JeevaniSM 2020-11-24 18:08:17
alancbhn 2020-11-24 17:52:57
If I build a website with Laravel and in the future I want to make it a native app for Android and iOS. Should I make it again from scratch?

option1 – convert it into a PWA
option 2 – just create a native front end and use the same backend with API

alancbhn 2020-11-24 18:09:40
JeevaniSM 2020-11-24 18:08:17
option1 – convert it into a PWA
option 2 – just create a native front end and use the same backend with API

Cool, I was thinking in the 2nd option

anuprasadgc 2020-11-24 19:48:36
laravel_discuss-60190.jpg
am getting this error
anuprasadgc 2020-11-24 19:49:13
laravel_discuss-60191.jpg

anuprasadgc 2020-11-24 19:49:14
laravel_discuss-60192.jpg

cccr85 2020-11-24 19:57:42
Парни подскажите, Article::all()->reverse() получаю все новости.

А нужно так. Все у которых определенный параметр = 1, и уже потом все остальные в порядке уменьшения id.

Как это реализовать?

То есть нужно 10 статей.
Это решается ->limit(10)

Но вначале должны быть все у кого inmain = 1, а потом остальные. Делать 2 запроса?

anuprasadgc 2020-11-24 19:58:29
anuprasadgc 2020-11-24 19:48:36
am getting this error

whos gonna help me

hypernxf 2020-11-24 20:04:27
Check your web.php
hypernxf 2020-11-24 20:04:38
make sure you have a route with the PUT method
anuprasadgc 2020-11-24 20:07:56
laravel_discuss-60197.jpg
this is web.php
|