G
G
gitdev2017-08-28 19:06:00
PHP
gitdev, 2017-08-28 19:06:00

Is it possible to use the standard User model to save an update to the DB? in laravel?

Is it possible to use the standard User model to update values ​​in the DB. in laravel or do I need to create a separate Eloquent model?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Twelfth Doctor, 2017-08-28
@verdex

It's not entirely clear what you mean. The User model can be used to update data in the users table, it will not work to update data in all tables.
Each Eloquent model corresponds to one table in the database.
If you want to update the values ​​in the entire database, then you need to either create a model for each table and access it, or use the Query Builder instead of models.

G
gitdev, 2017-08-28
@gitdev

The problem was the commas in rules.
'email' => 'required|string|email|max:200|unique:users,email,' . auth()->user()->id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question