This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ $errors->first('password')}} | |
<input name ="password" type="password"> | |
{{ $errors->first('password_confirm')}} | |
<input name ="password_confirm" type="password"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->validate($request,[ | |
'password' => 'required|min:8', | |
'password_confirm' => 'required|same:password', | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'custom' => [ | |
'attribute-name' => [ | |
'rule-name' => 'custom-message', | |
], | |
'password' => [ | |
'required' => 'パスワードは必須です', | |
'min' => '8文字以上で入力してください' | |
], | |
'password_confirm' => [ | |
'required' => 'パスワードを再入力してください', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Validation; | |
use Hash; | |
class oldPasswdValidator | |
{ | |
public function oldPassword($attribute, $value, $parameters) | |
{ | |
return Hash::check($value, $parameters[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//bootは最初からあるので、追記する | |
public function boot() | |
{ | |
Validator::extend('check_password', 'App\Validation\OldPassWordValidator@oldPassword'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$password = Auth::user()->password; | |
$this->validate($request,[ | |
'old_password' => "required|check_password:$password", | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//hook access_token | |
add_action('wo_set_access_token','wo_process_example'); | |
function wo_process_example( $data ){ | |
if( isset( $data ) ){ | |
} | |
// do something without the data | |
} | |
do_action('wo_endpoint_user_authenticated', array( $token ) ); | |
function add_allow_header( $headers ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//ついでに非 Laravelerの人のためにランダムなパスワード生成 | |
private function makeRandomPassword() | |
{ | |
$collectionA = array_rand(array_flip(range('a', 'z')), 4); | |
$collectionB = array_rand(array_flip(range('A', 'Z')), 4); | |
$collectionC = array_rand(array_flip(range(0, 9)), 3); | |
$collectionD = array_rand(array_flip(['!','$','%','&','(',')','*','+','/']), 3); | |
$passwordstr = array_merge($collectionA,$collectionB,$collectionC,$collectionD); | |
return str_shuffle(implode($passwordstr)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Collection; | |
class SampleController extends Controller | |
{ | |
private function makeRandomPassword() | |
{ | |
$collectionA = collect(range('a', 'z'))->random(4)->all(); | |
$collectionB = collect(range('A', 'Z'))->random(4)->all(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Sequence diagram code | |
sequenceDiagram | |
オブジェクト名 ->> 送り先オブジェクト名: メッセージ | |
送り先オブジェクト名 -x 送り先オブジェクト名: エラー | |
Note right of 送り先オブジェクト名: エラー発生<br/>バリデーション | |
送り先オブジェクト名 -->> オブジェクト名: 応答メッセージ | |
オブジェクト名 ->> 送り先オブジェクト名: メッセージ再送 | |
送り先オブジェクト名 --x オブジェクト名: 応答メッセージ 終了 |