All Projects → plank → Laravel Mediable

plank / Laravel Mediable

Licence: mit
Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel 5.

Projects that are alternatives of or similar to Laravel Mediable

Laravel Schedulable
Schedule and unschedule eloquent models elegantly without cron jobs
Stars: ✭ 78 (-85.58%)
Mutual labels:  hacktoberfest, eloquent, laravel
Laravel Medialibrary
Associate files with Eloquent models
Stars: ✭ 4,743 (+776.71%)
Mutual labels:  hacktoberfest, eloquent, laravel
Quicksand
Easily schedule regular cleanup of old soft-deleted Eloquent data.
Stars: ✭ 259 (-52.13%)
Mutual labels:  hacktoberfest, eloquent, laravel
Laravel Translatable
A Laravel package for multilingual models
Stars: ✭ 624 (+15.34%)
Mutual labels:  hacktoberfest, eloquent, laravel
Corcel
Use WordPress backend with Laravel or any PHP application
Stars: ✭ 3,504 (+547.69%)
Mutual labels:  hacktoberfest, eloquent, laravel
Laravel Wallet
Easy work with virtual wallet
Stars: ✭ 401 (-25.88%)
Mutual labels:  eloquent, laravel
Laravel Acl
This package helps you to associate users with permissions and permission groups with laravel framework
Stars: ✭ 404 (-25.32%)
Mutual labels:  hacktoberfest, laravel
Lada Cache
A Redis based, fully automated and scalable database cache layer for Laravel
Stars: ✭ 424 (-21.63%)
Mutual labels:  eloquent, laravel
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (-16.82%)
Mutual labels:  hacktoberfest, laravel
Laravel Model Cleanup
Clean up unneeded records
Stars: ✭ 388 (-28.28%)
Mutual labels:  eloquent, laravel
Laravel 8 Simple Cms
Laravel 8 content management system for starters.
Stars: ✭ 444 (-17.93%)
Mutual labels:  hacktoberfest, laravel
Laravel Dompdf
A DOMPDF Wrapper for Laravel
Stars: ✭ 4,978 (+820.15%)
Mutual labels:  hacktoberfest, laravel
Compoships
Multi-columns relationships for Laravel's Eloquent ORM
Stars: ✭ 537 (-0.74%)
Mutual labels:  eloquent, laravel
Laravel Datatables
jQuery DataTables API for Laravel 4|5|6|7|8
Stars: ✭ 4,134 (+664.14%)
Mutual labels:  hacktoberfest, laravel
Freek.dev
The sourcecode of freek.dev
Stars: ✭ 407 (-24.77%)
Mutual labels:  hacktoberfest, laravel
Comments
Native comments for your Laravel application.
Stars: ✭ 390 (-27.91%)
Mutual labels:  hacktoberfest, laravel
Laravel Cascade Soft Deletes
Cascading deletes for Eloquent models that implement soft deletes
Stars: ✭ 498 (-7.95%)
Mutual labels:  eloquent, laravel
Squire
A library of static Eloquent models for common fixture data.
Stars: ✭ 496 (-8.32%)
Mutual labels:  eloquent, laravel
React Native Background Upload
Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
Stars: ✭ 504 (-6.84%)
Mutual labels:  hacktoberfest, file-upload
Tenanti
[Package] Multi-tenant Database Schema Manager for Laravel
Stars: ✭ 525 (-2.96%)
Mutual labels:  hacktoberfest, laravel

Laravel-Mediable

Coveralls StyleCI Packagist

Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel.

Features

  • Filesystem-driven approach is easily configurable to allow any number of upload directories with different accessibility. Easily restrict uploads by MIME type, extension and/or aggregate type (e.g. image for JPEG, PNG or GIF).
  • Many-to-many polymorphic relationships allow any number of media to be assigned to any number of other models without any need to modify their schema.
  • Attach media to models with tags, in order to set and retrieve media for specific purposes, such as 'thumbnail', 'featured image', 'gallery' or 'download'.
  • Integrated support for integration/image for manipulating image files to create variants for different use cases.

Example Usage

Upload a file to the server, and place it in a directory on the filesystem disk named "uploads". This will create a Media record that can be used to refer to the file.

$media = MediaUploader::fromSource($request->file('thumb'))
	->toDestination('uploads', 'blog/thumbnails')
	->upload();

Attach the Media to another eloquent model with one or more tags defining their relationship.

$post = Post::create($this->request->input());
$post->attachMedia($media, ['thumbnail']);

Retrieve the media from the model by its tag(s).

$post->getMedia('thumbnail')->first()->getUrl();

Installation

Add the package to your Laravel app using composer

composer require plank/laravel-mediable

Register the package's service provider in config/app.php. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.

'providers' => [
    ...
    Plank\Mediable\MediableServiceProvider::class,
    ...
];

The package comes with a Facade for the image uploader, which you can optionally register as well. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.

'aliases' => [
	...
    'MediaUploader' => Plank\Mediable\MediaUploaderFacade::class,
    ...
]

Publish the config file (config/mediable.php) and migration file (database/migrations/####_##_##_######_create_mediable_tables.php) of the package using artisan.

php artisan vendor:publish --provider="Plank\Mediable\MediableServiceProvider"

Run the migrations to add the required tables to your database.

php artisan migrate

Documentation

Read the documentation here.

License

This package is released under the MIT license (MIT).

About Plank

Plank is a web development agency based in Montreal, Canada.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].