アプリ関連ニュース
- 2022年7月28日
- 技術情報
Emmetの使用(1)
nishida at 2022年07月28日 10:00:00
- 2022年7月26日
- 技術情報
5 Tricks with Laravel Timestamps
Today, I would like to share some tricks for Laravel Timestamps. Let’s take a look.
1. Changing the Timestamps Column names
Sometimes, you might have to change the timestamps column names : created_at and updated_at. In that case, you can set them in the model as follows.
class Product extends Model{
const CREATED_AT = ‘start_time’;
const UPDATED_AT = ‘modify_time’;
}
2. Disabling the timestamps that are filled automatically by Laravel
You can disable the automatic filling timestamps in Eloquent model as follows.
class Product extends Model{
public $timestamps = FALSE;
}
3. Using shortcuts for order by timestamps
You can use latest() instead of orderBy(‘created_at’, ‘desc’).
You can use oldest() instead of orderBy(‘created_at’, ‘asc’).
4. Updating data without updating updated_at
In some cases, you can update the data without touching ‘updated_at’ column as follows.
$product = Product::find(1);
$product→name = ‘product1’;
$product→timestamps = false;
$product→save();
5. Updating only ‘updated_at’ with short way
You can update only ‘updated_at’ as following.
Use
$product→touch();
instead of:
$product→update([‘updated_at’=>now()]);
This is all for now. Hope you enjoy that.
By Asahi
waithaw at 2022年07月26日 10:00:00
Google Wallet
The new Google Wallet app is now available to all customers. The official release of Google Wallet is the latest step in the long history of variations of Google’s payment apps. The company created Google Pay in 2018 by combining Google Wallet and Android Pay.
Currently, Google is announcing the return of its wallet at the Google I / O event in May to create a dedicated home for payment cards, tickets, government IDs, vaccination proofs, and even car keys. Split again. Users can use the app to pay for vendors that use Google Pay.
You can download Google Wallet from the Google Play Store. The user must be running Android 5.2 or later and have a Google account and a valid phone number. From there, you’ll be able to add different cards to your Google Wallet. If you already have your card connected to the Google Play Store or YouTube, your cards will be loaded.
You can also checkout the youtube video here.
Yuuma
yuuma at 2022年07月25日 10:00:00
- 2022年7月22日
- 技術情報
知っておいていただきたいこと – 12
今日もlaravelのTipsをいくつか共有したいと思います。
アプリケーションを作成する際、他のユーザーがアクセスできない管理者ロールを用意することがほとんどでしょう。別のコントロールを繰り返し追加する代わりに、 ルートやコントローラに適用できるミドルウェアを作成することを検討しましょう。これは、absort ヘルパーや absort_unless ヘルパーを使えば簡単に実現できます。
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
class CheckUserIsAdmin{
public function handle(Request $request, Closure $next){
abort_unless(Auth::user()?->isAdmin(), Request::HTTP_FORBIDDEN);
return $next($request);
}
}
そして、そのミドルウェアをルートHTTPカーネルに追加する。
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel{
protected $routeMiddleware = [
'admin' => \App\Http\Middleware\CheckUserIsAdmin::class;
];
}
最後に、ミドルウェアを適用する
use App\Http\Middleware\AdminUserController;
use App\Http\Middleware\AdminDashboardController;
Route::prefix('admin')->middleware('admin')->group(function(){
Route::get('/',[AdminDashboardController::class, 'index']);
Route::get('/users',[AdminUserController::class, 'index']);
});
ということで、今回はこれで終わります。
金曜担当 – Ami
asahi at 2022年07月22日 10:00:00
Nothing Phone 1
Nothing finally announces its first smartphone, the Nothing Phone 1 by OnePlus co-founder Carl Pei. Nothing is said that Phone 1 will be available in more than 40 markets, including the UK, Japan, India, and countries of the Europe.
The Nothing Phone (1) is an Android device with the Qualcomm Snapdragon 778G + chipset introduced by Qualcomm over a year ago. It has the same power and performance as the regular Snapdragon 778G found on overseas mobile phone models, but the “plus” indicates that it has changed which can customize the chip to allow the phone (1) to be wirelessly and reversely charged.
The screen is a 6.55 inch flexible OLED display with a resolution of 2400 x 1080 pixels and a maximum peak brightness of 1200 knits for very sunny conditions. The screen has an adaptive refresh rate of 120Hz, which matches mid-range devices such as the Samsung Galaxy A535G and flagship products such as the Google Pixel 6 Pro.
Phone (1) can be used with 8GB of RAM and 128GB of storage, or 12GB of RAM and 256GB of storage.
It packs its in-display fingerprint sensor, dual stereo speakers, IP53 water resistance, and Face ID-like unlock capabilities with a 4,500mAh battery. With dual cameras: a 50 MP main camera with f/1.88 aperture along with a 50 MP ultra-wide sensor with f/2.2 aperture and macro capabilities. There’s also a 16 MP front-facing camera with an f/2.45 aperture and night shooting capabilities.
The cool thing is there are 900 creatively placed LEDs on the back of the Nothing Phone (1). They are customizable and can help notify you when a particular contact calls or sends a message to your phone.
Actually there are lot of features and the price is affordable which tends to get interest by end users. On the other hand, the maturity and community is still building and the product still might contains bugs and errors.
Yuuma
yuuma at 2022年07月18日 10:00:00