G
G
ganjo8882020-01-14 13:38:15
Laravel
ganjo888, 2020-01-14 13:38:15

How to make a select when creating a post?

$user = User::create(['id'=>1,'name'=>'test'])
When creating a record, all saved fields are returned, how can I make it so that when saving I can specify the fields that I want to see, for example, here I I want to see only name
Tried like this User::create(['id'=>1,'name'=>'test'])->select('name')->get()
but this returns all records in the database

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2020-01-14
@Alex_Wells

See where?
In short, it's not okay. And you don't need to. What do you want to achieve?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question