public $galleryImages;
$this->galleryImages = $galleryImages;
Remove [] from argument as well. If you want to just show the property as an array do:
public $galleryImages = [];
I am using command handlers in my app which is a social network that allows users to upload image galleries.
I have come across an issue which I can't seem to resolve.
When my controller calls the command class I can't figure out how to pass the array of images from the input form into the command. I am declaring public properties in the command class and then trying to initiate them in the constructor.
I have been able to do this for basic inputs but just can't figure out a way to do it for arrays.
Here's an example
class CreateGalleryCommand {
public $galleryName;
public $galleryDesc;
public $galleryImages[];
public $user_id;
public function __construct($galleryName, $galleryDesc, $galleryImages[], $user_id)
{
$this->galleryName = $galleryName ;
$this->galleryDesc = $galleryDesc;
$this->galleryImages[] = $galleryImages[];
$this->user_id = $user_id;
}
}
Has anyone been able to do this? If so, are you able to provide advice and guidance on how to go about implementing a solution.
Thanks
Please or to participate in this conversation.