V
V
Vitaly Sherstobitov2021-03-11 14:29:42
Laravel
Vitaly Sherstobitov, 2021-03-11 14:29:42

How to create a custom user object?

I need to create a custom user object:

$user = new User($user_id); 
или 
$user = user($user_id);

So that later, thanks to this object, get pictures like this:
Auth::user()->getMedia('passport_heads')->first()->getUrl('thumb')


Is there any way to make a custom user object using mine as an example?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2021-03-18
@xxx2coder

The user is a regular eloquent model, and you can work with it in the same way as with the rest, see the help.
https://laravel.com/docs/8.x/eloquent#retrieving-s...

V
Vitaly Sherstobitov, 2021-03-18
@xxx2coder

Anton Anton , https://laravel.com/docs/8.x/eloquent#retrieving-s...
Ps: I don't know how else to close the question. Anton, if you see, then leave an answer so that I choose your answer as a solution

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question