0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel - デフォルトのユーザー登録に処理を追加する【初心者向け・備忘録】

Posted at

※まだEloquentの使い方に慣れていない方に向けた内容です。

Laravelのデフォルト機能で作成できるregisterControllerで、ユーザを作成する際に何かしらの処理を追加する方法です。

createメソッド内の

User::create([
'name' => $data['name']...)

を一度変数に格納し、

例 : $user = User::create...

その後、登録時に行いたい処理を記載したら

return $user;

を返します。

※登録処理自体に変更を加えたい場合は、registerControllerで

public function register(Request $request)

をオーバーライドしてあげましょう。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?