Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to use optional parameters (i.e. support of folders) #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

carnevalle
Copy link

I have added support for using the optional parameters in the Cloudinary Upload API. The parameters are configurable when creating the field using the cloudinary method, like this

use Silvanite\NovaFieldCloudinary\Fields\CloudinaryImage;

public function fields(Request $request)
{
    return [
        ...
        CloudinaryImage::make('Image')->cloudinary([
            'folder' => 'images'
        ]),
    ]
}

Using optional parameters it is possible to i.e. save uploaded files to a specific folder.
Copy link

@FlavioIshii FlavioIshii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there plans to review and merge this PR? Would be nice to have support for folders.

@@ -20,14 +23,27 @@ public function __construct($name, $attribute = null, $disk = 'cloudinary', $sto
{
parent::__construct($name, $attribute, $disk, $storageCallback);

$this->storeAs(function (Request $request) {
$this->store(function(Request $request, $model, $attribute, $requestAttribute){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->store(function(Request $request, $model, $attribute, $requestAttribute){
$this->store(function(Request $request, $requestAttribute) {

@@ -21,14 +21,27 @@ public function __construct($name, $attribute = null, $disk = 'cloudinary', $sto
{
parent::__construct($name, $attribute, $disk, $storageCallback);

$this->storeAs(function (Request $request) {
$this->store(function(Request $request, $model, $attribute, $requestAttribute){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->store(function(Request $request, $model, $attribute, $requestAttribute){
$this->store(function(Request $request, $requestAttribute) {

@@ -21,7 +23,20 @@ public function __construct($name, $attribute = null, $disk = 'cloudinary', $sto
{
parent::__construct($name, $attribute, $disk, $storageCallback);

$this->thumbnail(function () {
$this->store(function(Request $request, $model, $attribute, $requestAttribute){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->store(function(Request $request, $model, $attribute, $requestAttribute){
$this->store(function(Request $request, $requestAttribute) {

@@ -20,14 +20,27 @@ public function __construct($name, $attribute = null, $disk = 'cloudinary', $sto
{
parent::__construct($name, $attribute, $disk, $storageCallback);

$this->storeAs(function (Request $request) {
$this->store(function(Request $request, $model, $attribute, $requestAttribute){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->store(function(Request $request, $model, $attribute, $requestAttribute){
$this->store(function(Request $request, $requestAttribute) {

@lukebouch
Copy link
Collaborator

@carnevalle @FlavioIshii This looks really interesting. I will take a look at this and see if we can get this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants