And how do you translate it on view?

|
Mahdi_khani 2020-04-24 12:20:48
Hi to all
I use this code to attaching a relationship to a model with additional data to be insert into the intermediate table
$user->roles()-attach($roleId,[‘expires’ => $expires]);
Everything is ok.
My question is how to get the additional data in
$user->roles;
Thanks
Mahdi_khani 2020-04-24 12:44:19
Mahdi_khani 2020-04-24 12:20:48
Hi to all
I use this code to attaching a relationship to a model with additional data to be insert into the intermediate table
$user->roles()-attach($roleId,[‘expires’ => $expires]);
Everything is ok.
My question is how to get the additional data in
$user->roles;
Thanks

Anybody

skys215 2020-04-24 12:56:05
Akshay Bhardwaj 2020-04-24 11:28:54
facebook authentication

read the doc, it’s not laravel problem

skys215 2020-04-24 12:56:45
Mahdi_khani 2020-04-24 12:20:48
Hi to all
I use this code to attaching a relationship to a model with additional data to be insert into the intermediate table
$user->roles()-attach($roleId,[‘expires’ => $expires]);
Everything is ok.
My question is how to get the additional data in
$user->roles;
Thanks

$user->load(‘roles’) or $user->with(‘roles’)
it’s all written in doc

Mahdi_khani 2020-04-24 13:05:22
Its ok but cant get the additional data
hiteshv253 2020-04-24 13:06:23
update your composer
skys215 2020-04-24 13:08:43
what do you mean by additional data
Ujjaval Vaishnav 2020-04-24 13:36:34
I am planning to building SaaS application
Where all the customers are store in a single database and each client need a separate Database. While using same code.

Can anyone suggest better way to start??

skys215 2020-04-24 13:41:47
Separate db
Ujjaval Vaishnav 2020-04-24 13:57:33
skys215 2020-04-24 13:41:47
Separate db

Yes

Ujjaval Vaishnav 2020-04-24 14:16:11
Is any packages available for the same?
hcdyncghvgghhv 2020-04-24 14:17:00
skys215 2020-04-24 13:41:47
Separate db

This makes updateing/migrating more complex/painful.
I personally used the same db approach, you have to be very careful though to include the tennant id into every query.

hcdyncghvgghhv 2020-04-24 14:19:02
In hindsight im glad I took this approach because we made frequent and big changes to the schema. With a multi-db approach this would have been more work for us regularly.
hcdyncghvgghhv 2020-04-24 14:19:42
Another thing is we have our own dashbord where we can keep track of the whole system easily with the singledb approach
sahilbalgotra 2020-04-24 14:20:06
How make a point system on order place if user place a order i have toh 5 point in his account i am not getting the logic how could i do
hcdyncghvgghhv 2020-04-24 14:21:18
sahilbalgotra 2020-04-24 14:20:06
How make a point system on order place if user place a order i have toh 5 point in his account i am not getting the logic how could i do

formulate you question better

sahilbalgotra 2020-04-24 14:22:25
hcdyncghvgghhv 2020-04-24 14:21:18
formulate you question better

I want a point base system if user place order of any thing i have to credit 5 point in here account

hcdyncghvgghhv 2020-04-24 14:23:04
make a new field in the user-table “points”
skys215 2020-04-24 14:23:09
hcdyncghvgghhv 2020-04-24 14:17:00
This makes updateing/migrating more complex/painful.
I personally used the same db approach, you have to be very careful though to include the tennant id into every query.

I meant different table

hcdyncghvgghhv 2020-04-24 14:23:54
when asuccesful order is placed do user->points +5
hcdyncghvgghhv 2020-04-24 14:24:44
you can do it directly in the SuccesfulOrderPlacedController or you can make an event/listener
vikash_sharma90 2020-04-24 14:49:30
ram_the_archer 2020-04-24 07:14:47

Was it resolved?

ram_the_archer 2020-04-24 14:50:34
Haa ho gya and thanks to @skys
vikash_sharma90 2020-04-24 14:58:45
👍🏻OK
raphaeldealmeida 2020-04-24 15:26:06
Hi guys, I have a status database column, (1=>’opened’, 2=>’closed’, 3=>’canceled’) How can I implement it? Const, array, class, third party package? I would like to have a expressive codebase, so use some like $status = opened instead $status = 1
skys215 2020-04-24 15:39:51
Const
raphaeldealmeida 2020-04-24 15:40:39
skys215 2020-04-24 15:39:51
Const

And how do you translate it on view?

aayush1485 2020-04-24 16:14:30
Hello guys,
I have two timestamp start-time, end time like this in my db coloumn votedate (09:45- 2:30),

now I need to compare this with (11:30-8:30)start-time ,endtime respectively

I am doing this to check if my stored db time is overlapped with my current input time or not

I tried to compare it with strtotime()but nothing works.
Please help

raphaeldealmeida 2020-04-24 16:23:18
aayush1485 2020-04-24 16:14:30
Hello guys,
I have two timestamp start-time, end time like this in my db coloumn votedate (09:45- 2:30),

now I need to compare this with (11:30-8:30)start-time ,endtime respectively

I am doing this to check if my stored db time is overlapped with my current input time or not

I tried to compare it with strtotime()but nothing works.
Please help

You could convert to carbon and use compare https://carbon.nesbot.com/docs/#api-comparison

skys215 2020-04-24 16:35:24
raphaeldealmeida 2020-04-24 15:40:39
And how do you translate it on view?

you can use mutator to acheive that

raphaeldealmeida 2020-04-24 16:36:27
skys215 2020-04-24 16:35:24
you can use mutator to acheive that

I think I’ll use a combination of mutator, accessor and const. Thank you

skys215 2020-04-24 16:48:49
Not at all
DesolatorMagno 2020-04-24 17:56:28
Mahdi_khani 2020-04-24 12:20:48
Hi to all
I use this code to attaching a relationship to a model with additional data to be insert into the intermediate table
$user->roles()-attach($roleId,[‘expires’ => $expires]);
Everything is ok.
My question is how to get the additional data in
$user->roles;
Thanks

In the relationship inside the model you can specify what additional attributes from the pivot table you will use

2020-04-24 19:52:43
Buenas a todos quiero compartir este articulo enfocado en los que nos preguntamos 👀 en que lenguajes y tecnologías desarrollaron Slack o visual studio code, la respuesta es *ELECTRON*, https://www.electronjs.org/ 👈🏼 🔥 es un framework de javascript 👨‍💻 Mas Info
https://brainhub.eu/blog/electron-framework-example-apps/

Quizás te preguntas lo mismo pero como y con que se creo photoshop 🤩
La respuesta es *C* como lenguaje de programación y *QT* como Ide de desarollo de sistemas de alto rendimiento 👉🏼 https://www.qt.io/download

Saludos *Jorge Gutierrez*
https://www.instagram.com/jorgutiz/

*Academia*
https://www.instagram.com/bioonixacademy/

7 Famous Desktop App Examples Using Electron JS | BrainhubBrainhub
Study the most famous Electron JS app examples and discover reasons why Electron JS is the best desktop app framework available.
2020-04-24 20:20:10
Please provide me some interview questions on Laravel that are being asked most frequently
2020-04-24 20:20:31
For freshers
Mahdi_khani 2020-04-24 20:25:35
DesolatorMagno 2020-04-24 17:56:28
In the relationship inside the model you can specify what additional attributes from the pivot table you will use

Thanks
But cant find any code or solution

DesolatorMagno 2020-04-24 20:26:13
Search “withPivot”
2020-04-25 02:20:50
#Q How can I get the all login sessions related to a user?
Dev 2020-04-25 04:19:35
2020-04-25 02:20:50
#Q How can I get the all login sessions related to a user?

You can maintain a separate session table to store the user logins. So, whenever they login, you can store their IDs in a row along with other details like user agent (browser), location, IP address, operating system and things like that.

giorbismiguel 2020-04-25 06:41:04
Mahdi_khani 2020-04-24 12:20:48
Hi to all
I use this code to attaching a relationship to a model with additional data to be insert into the intermediate table
$user->roles()-attach($roleId,[‘expires’ => $expires]);
Everything is ok.
My question is how to get the additional data in
$user->roles;
Thanks

Use pivot, find hoe to use in Laravel documentation

giorbismiguel 2020-04-25 06:43:07
Ujjaval Vaishnav 2020-04-24 13:36:34
I am planning to building SaaS application
Where all the customers are store in a single database and each client need a separate Database. While using same code.

Can anyone suggest better way to start??

Use multitenant

TheGuyi 2020-04-25 06:44:21
hello guys? i have an issue im trying to change color of a row depending on the value from the database..
TheGuyi 2020-04-25 06:44:56
TheGuyi 2020-04-25 06:44:21
hello guys? i have an issue im trying to change color of a row depending on the value from the database..

laravel_discuss-34708.jpg
@php
$ursb_flag = pending;
$rowclass = ‘yellow’;

if ($ursb_flag !== approved)
{
$ursb_flag = $post->ursb_verify_flag;
if ($rowclass == ‘red’) $rowclass = ‘white’;
else $rowclass = ‘grey’;
}
@endphp
<tr class=”{{ $rowclass }}”>
<td>{{ $post->ursb_verify_flag }}</td>
</tr>

DesolatorMagno 2020-04-25 06:45:16
the error is in pending.
TheGuyi 2020-04-25 06:46:26
DesolatorMagno 2020-04-25 06:45:16
the error is in pending.

pending is my default value… i have 3 values coming from the db.. pending is yellow.. then approved is green

DesolatorMagno 2020-04-25 06:46:39
READ AGAIN
DesolatorMagno 2020-04-25 06:46:56
read only the word pending until you get the error.
TheGuyi 2020-04-25 06:47:42
DesolatorMagno 2020-04-25 06:46:56
read only the word pending until you get the error.

see in my code i am setting default to pending

DesolatorMagno 2020-04-25 06:48:08
laravel_discuss-34714.jpg

|