0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Laravel】バリデーション FormRequestを継承せずに

0
Last updated at Posted at 2026-05-20

以下の連想配列を定義する

バリデーション用の連想配列
    public static $rules = [

        'modalItemCd' =>
            'required|unique:item_table,item_cd',

        'modalItemName' =>
            'required|string|max:60',
    ];

    public static $messages = [

        'modalItemCd.required' =>
            '商品コードを入力してください',
    ];
validate()メソッドで呼び出す
$request->validate(
    Item::$rules,
    Item::$messages
);
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?