2021-08-03から1日間の記事一覧
use Illuminate\Support\Facades\Hash; ... $user = User::where(['id' => 1])->firstOrFail(); // passwordはHash::make()で作成 $beforeHash = $request['beforeHash']; if (Hash::check($beforeHash, $user->password)) { echo("一致しました!"); } else…
withで指定した要素に無名関数を渡す order by Order::with(['order_detail' => function ($query) { $query->orderByDesc('created_at'); }])->get(); select * from `order_details` where `order_details`.`id` in (1) order by `created_at` desc where …
スクロールバーのデザインの為 <template> <style>.scroll-bar-input::-webkit-slider-thumb {width: $ratio + %;}</style> </template> こういうことがしたかったが、 VueCompilerに怒られる VueCompilerError: Tags with side effect (<script> and <style>) are ignored in client component templates. 対策 …
Laravelでhaving句を使って集計を行うとき、こんな書き方をする。 Model::withCount('xxxx')->having('xxxx_count', '>', 1); ただ、paginateを付けたい場合 Model::withCount('xxxx')->having('xxxx_count', '>', 1)->paginate(20); とやると、エラーが出る…
PHPerからしたらありふれすぎた話だけど、2021/07/31の1ヶ月前をCarbonで取得しようとして死んだ。 なにがおきたか こうすると $date = new Carbon('20210731')->subMonth(1); echo($date); こうなる 2021-07-01 00:00:00 2021-06-30 00:00:00じゃないの? …