BBinotaLIUinblog.binota.org·May 8, 2023 · 3 min readMy Laravel Development EnvironmentIn Laravel applications, we use dd() to dump data, or Log::debug() to write debugging messages to log files. These are pretty handy functions. However, do you know there are other tools that can help you? These tools can help you to improve the effic...00
BBinotaLIUinblog.binota.org·Jan 10, 2023 · 4 min readYou Should Use ISO-8601 for Time DurationsCache TTL In writing cache logic, we often need to specify a time duration for the cache to expire. It's called TTL, or "Time To Live." Considering the following code: Cache::remember(key: 'all-users', ttl: 60 * 60 * 24, function () { return User::...00
BBinotaLIUinblog.binota.org·May 14, 2022 · 1 min readFnChainFnChain is an experimental helper I came up with when dealing with the following nesting closure: return $query ->where('is_enabled', true) ->where('available_from', '<=', DB::raw('NOW()')) ->where( fn (Builder $q) => $q ...00
BBinotaLIUinblog.binota.org·Apr 15, 2022 · 1 min readModel::fresh() v.s. Model::refresh()Every time I try to "refresh" a model, I have always encountered this problem. Is it Model::fresh()? Or Model::refresh(). Both method exists. And both method have nearly same description. So, what's the different between these two methods? Model::fre...00
BBinotaLIUinblog.binota.org·Sep 24, 2018 · 5 min readGit Rebase IRLThis is an old blog post I wrote back in 2018. I pick it up from the wayback machine and fixed some typo & re-wording some paragraphs. Intro Many people might already known that there is a command call git rebase, but most of people don't know how ...00