碎片

  • https://sli.dev/

  • ```php $img = "https://xxxxx.com/1234.png"; //普通save $file = Image::make($img)->save('public/bar.png'); //等比例剪裁 $file = Image::make($img)->fit(300, 200, function ($constraint) { $constraint->up...

  • vector可編輯/轉色 此網站有部分免費的vector可供下載 https://www.vecteezy.com/free-vector/letter-u?license-free=true

  • ```php $count = User::whereRaw('DATE(created_at) =? ', '2022-05-16')->count(); or $count = User::whereDate('created_at', '=', date($date))->count(); ```

  • ```php $chats = Message::with('sender','recipient') ->where('toId',$id) ->whereRaw('id IN (select MAX(id) FROM messages GROUP BY fromId)') ->orderBy('createdAt','desc') ->paginate(10) ```

  • ```php public function index() { $row = User::all(); return response()->json($row); } ```

  • 有朋友合作項目有需要,在此分享給他 https://flatpickr.js.org/options/ 同時這套flatpickr的確不錯,雖然界面不是我喜歡,但能脫離jQuery的確不錯 甚至連github 也有15k star

  • https://laracasts.com/discuss/channels/laravel/laravel-get-visitors-ip-location-and-city

  • http://tabulator.info/ 可以試用一下 demo ref:http://rubick.left4code.com/page/side-menu/dark/tabulator

  • ```mysql SELECT * FROM `notifications` WHERE JSON_EXTRACT(data, "$.user_name") = 'sky' ``` demo data `notifications.data` ```json {"id": "1", "user_name ": "sky"} {"id": "2", "user_name ": "Joe...

  • 一定要小心使用 ```php use Illuminate\Support\Facades\DB; //...... DB::unprepared(); ``` These are all prepared statement to prevent SQL injection into database. However you might needed to run query...

  • https://output.jsbin.com/xepererege/ ```javascript // Nested demo var nestedSortables = [].slice.call(document.querySelectorAll('.nested-sortable')); // Loop through each nested sortable element for...

  • https://jsfiddle.net/6au1onme/1/

  • https://codepen.io/vtno/pen/MXmpoy

  • php5.2+ ```php //$dir = delete folder $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator($it, RecursiveIteratorItera...

  • https://web-crunch.com/posts/vanilla-javascript-form-validation https://codepen.io/webcrunchblog/pen/ZEWwvZy

  • ```php //$image base64 image $imageName = time() . 'ava.png'; $image = str_replace('data:image/png;base64,', '', $image); $image = str_replace(' ', '+', $image); Storage::disk('temp_avatar')->pu...

  • https://draculatheme.com/

  • ```php $email = 'email@email.com'; $content = "Hello, Welcome to our site."; $title = "Hi,welcome user!"; $data = [ 'content' => $content, 'tit...

  • ```bash brew uninstall php ``` 這樣就把你的php刪除了 但如果馬上重裝,又會看到貌似是之前的設定 應該手動把這個位置都刪除再重裝就ok `/opt/homebrew/etc/php/` 然後再重裝即可 順帶一提,如果你是使用m1的...