定制 larabra/laravel-media-library-input 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

larabra/laravel-media-library-input

Composer 安装命令:

composer require larabra/laravel-media-library-input

包简介

HTML input for Spatie Media Library

README 文档

README

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require larabra/laravel-media-library-input

Usage

Model

// app\Model\News.php
namespace App\Models;

use Illuminate\Database\Eloquent\Model as Model;
use Larabra\LaravelMediaLibraryInput\Casts\MediaCastAttribute; // <---
use Larabra\LaravelMediaLibraryInput\Models\MediableModel; // <---
use Spatie\MediaLibrary\HasMedia;

class News extends Model implements HasMedia
{
    use InteractsWithMedia;
    use MediableModel; // <--- create/add medias with form submit

    // "cover" is a fake field, so add it as append and create its cast

    protected $appends = [
        'cover',
    ];

    protected $casts = [
        'cover' => MediaCastAttribute::class,
    ];
    // ...
}

Controller

// app\Http\Controllers\NewsController.php
<?php

namespace App\Http\Controllers;

use App\Repositories\NewsRepository;
use Larabra\LaravelMediaLibraryInput\Http\Controllers\MediableController;

class NewsController extends AppBaseController
{
    use MediableController; // <--- add controller methods to manager medias

    /** @var  NewsRepository */
    private $newsRepositorysitory;

    public function __construct(NewsRepository $newsRepository)
    {
        $this->newsRepository = $newsRepository;
    }

Views

{!! Form::label('cover', 'Capas:') !!}
{!! Form::medias('cover', ['multiple' => true]) !!}

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固