2022年6月
- 2022年6月07日
- 技術情報
3 Ways to group routes in laravel
Today, I would like to share about 3 ways to group routes in laravel. Let’s take a look.
1. Route::resource
We can create a resource controller and group routes for CRUD actions of that controller as follow.
Route::resource('books', BookController::class);
2. Route groups within another route group
We can groups routes within another route groups like nested ones.
Route::middleware('auth')->group(function() {
Route::middleware('admin')->prefix('admin')->group(function() {
Route::get(...)
});
Route::middleware('member')->prefix('member')->group(function() {
Route::get(...)
});
});
3. Route::controller() in Laravel 9
In laravel 9, we can group the routes without repeating controller name for the same controller.
Route::controller(PostController::class)->group(function() {
Route::get('posts', 'getPosts');
Route::put('posts/update', 'updatePost');
Route::delete('posts/delete/{id}', 'deletePost');
});
This is all for now. Hope you enjoy that.
By Asahi
waithaw at 2022年06月07日 10:00:00
- 2022年6月06日
- AI
What is ONNX
ONNX is a machine learning framework which acts like a medium to convert between different machine learning frameworks.
ONNX is designed to enable framework interoperability. There are many great machine learning libraries in multiple languages — PyTorch, TensorFlow, MXNet, and Caffe are just a few of the most popular ones in recent years, but there are many others.
The idea is that you can use one stack of tools to train your model and use another for inference and prediction to expand your model.
For example, once you’ve trained your model, you need to deploy it to a new iOS app so that anyone with a previously trained model can see the safety of their food. I first trained my model with PyTorch, but iOS expects to use CoreML for use within the app. ONNX is an intermediate representation of the model that allows you to easily move from one environment to another.
With tools such as ONNX-CoreML, you can now easily convert pre-trained models to files, import them into XCode, and integrate them seamlessly with your application.
This is just an overview of what ONNX is about. I will talk more detail in future.
Yuuma
yuuma at 2022年06月06日 10:00:00