Package Data | |
---|---|
Maintainer Username: | juice |
Package Create Date: | 2018-11-26 |
Package Last Update: | 2020-07-27 |
Language: | PHP |
License: | proprietary |
Last Refreshed: | 2024-11-23 03:11:08 |
Package Statistics | |
---|---|
Total Downloads: | 14 |
Monthly Downloads: | 4 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Provide attachment controller and just use it in your application routes. We take care rest of things.
run composer require command composer require juice/attachments
register \Juice\Attachments\AttachmentsServiceProvider::class
service provider
copy config file and set it up
Laravel - php artisan vendor:publish --provider="Juice\Attachments\AttachmentsServiceProvider"
Lumen - cp vendor/juice/attachments/config/juice-attachments.php config/
(make sure config directory exist)
run setup command php artisan attachment:setup
run database migration php artisan migrate
setup your application routes
done
*:Assume route namespace is \Juice\Attachments\Controllers
end point
AttachmentController@upload
method parameters
none
query string
none
form data
| field | type | required | | :-------: | :------------: | :------: | | ja_file[] | array of files | ✓ |
return value
array of successfully uploaded files' name, e.g.
["sjdwd.png", "pweog.pdf", "msptw.jpeg"]
route example
Route::post('/attachments', 'AttachmentController@upload');
end point
AttachmentController@download
method parameters
| field | type | required | | :-------: | :----: | :------: | | $filename | string | ✓ |
query string
| field | type | required | default | remark | | :---: | :-----: | :------: | :-----: | :---------------------------------: | | d | boolean | | 0 | true: attachmentfalse: inline |
form data
none
return value
Symfony\Component\HttpFoundation\BinaryFileResponse
route example
Route::get('/attachments/{id}', 'AttachmentController@download'); // https://example.com/attachments/sjdwd.png
end point
AttachmentController@trash
method parameters
| field | type | required | | :-------: | :----: | :------: | | $filename | string | ✓ |
query string
none
form data
none
return value
json response contain success key, e.g.
{
"success": true
}
route example
Route::delete('/attachments/{id}', 'AttachmentController@trash'); // https://example.com/attachments/sjdwd.png