This plugin adds the ability for users to work with media files.
- Install the package using the following command:
composer require ronasit/laravel-media
- Publish the package configuration:
php artisan vendor:publish --provider=RonasIT\\Media\\MediaServiceProvider
- For Laravel <= 5.5 add
RonasIT\Media\MediaServiceProvider::class
to configapp.providers
list. - Set your project's User model to the
media.classes.user_model
config.
All media routes, will be automatically registered with the package installation.
You can manually register package routes in any place in your app routes using Route::media()
helper:
#routes/api.php
<?php
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => ['my_auth']], function () {
Route::media();
});
In this case automatically registered package routes will fails with the 404
code error.
You can register only necessary routes:
#routes/api.php
<?php
use Illuminate\Support\Facades\Route;
Route::media([
'create' => true,
'delete' => true,
'bulk_create' => false,
'search' => true,
]);
Integration with LaravelSwagger
This package includes OpenAPI documentation file. To include it to your project's documentation, you need to register it in the auto-doc.additional_paths
config:
vendor/ronasit/laravel-media/documentation.json
Thank you for considering contributing to Laravel Media plugin! The contribution guide can be found in the Contributing guide.
Laravel Media plugin is open-sourced software licensed under the MIT license.