| Package Data | |
|---|---|
| Maintainer Username: | miladimos |
| Maintainer Contact: | miladimos@outlook.com (miladimos) |
| Package Create Date: | 2021-08-23 |
| Package Last Update: | 2025-07-25 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-23 15:03:25 |
| Package Statistics | |
|---|---|
| Total Downloads: | 28 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 4 |
| Total Watchers: | 2 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
A package for attachment files to models
composer require laravelir/attachmentable
Laravelir\Attachmentable\Providers\AttachmentableServiceProvider::class,
php artisan attachmentable:install
First add Attachmentable trait to models that you want have attachments
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravelir\Attachmentable\Traits\Attachmentable;
class Post extends Model
{
use HasFactory,
Attachmentable;
}
in controllers you have these methods:
namespace App\Http\Controllers;
use App\Models\Post;
class PostController extends Controller
{
public function index()
{
$post = Post::find(1);
$post->attachments // return all attachments
}
}