2021/07/20〜09/10

移行前記事

#7 駆け出しエンジニアのメモ

Laravel

Laravelでコマンドラインアプリケーションを作成する - Qiita

        abort_if(
            Comment::where('user_id', $userId)->orWhere('deleted_at', null)->count() > 100,
            422
        );
$collection = collect([1, 1, 2, 2, 3, 4, 2]);

$unique = $collection->unique();

$unique->values()->all();

// [1, 2, 3, 4]
use Illuminate\\Support\\Str;
$random = Str::random(40);
$dt = new Carbon('2018-08-07 19:55:33');
echo $dt->toDateTimeString(); // 2018-08-07 19:55:33
$collection = collect([1, 2, 3, null, false, '', 0, []]);

$collection->filter()->all();

// [1, 2, 3]
/users/{userid}/comment 
// この場合、usersの情報が必ず必要なため、コメントのモデルで必要なくとも、引数で、ユーザーモデルが必要