PHP code example of pakpromo / laravel-filemanager
1. Go to this page and download the library: Download pakpromo/laravel-filemanager library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pakpromo / laravel-filemanager example snippets
<x-filemanager-file-upload name="image" />
<x-filemanager-file-upload name="image" :model="$model" />
$model = Model::find(1);
$model->handleFileFromRequest()->toFileCollection();
$model->handleFileFromRequest('banner')->toFileCollection();
$model->handleFileFromRequest()->toFileCollection('images');
public function defaultCollection(): string
{
return 'promo_images';
}
$model->handleFileFromRequest()->useDisk('s3')->toFileCollection();
public function registerFileConversions()
{
$this->addFileConversion('promo_image')
->width(420)
->height(350);
}
public function registerFileConversions()
{
$this->addFileConversion('promo_image')
->width(420)
->height(350);
$this->addFileConversion('banner')
->width(700)
->height(550);
}
$this->addFileConversion('promo_image')
->width(420)
->height(350)
->crop();
$model->handleFileFromRequest()->withoutConversions()->toFileCollection();
<x-filemanager-dropzone name="gallery" />
$model->attachGalleryToModelFromRequest('gallery')->toFileCollection();
<x-filemanager-dropzone name="gallery" collection="dropzone" />
<x-filemanager-dropzone name="gallery" :model="$model" />
<x-filemanager-dropzone name="gallery" message="Drop files here" />
$model->addFileFromUrl($url, 'image')->toFileCollection();
<x-filemanager-file-upload name="image" setting="{{ setting()->get('name') }}" />
setting()->upload($request->toArray(), 'file_name');
setting()->upload($request->toArray(), 'file_name', 'option_name');
setting()->getFile('name');
bash
php artisan vendor:publish --provider="PakPromo\FileManager\FileManagerServiceProvider" --tag=filemanager-config
bash
php artisan vendor:publish --provider="PakPromo\FileManager\FileManagerServiceProvider" --tag=filemanager-migration
bash
php artisan migrate