You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cant pass resource collection to event classes as property, becouse serialization of 'class@anonymous' is not allowed.
Steps To Reproduce:
Create any event class.
Instantiate it with resource collection.
Try to fire event or dispath it.
In code
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Http\Resources\Json\Resource;
class TestEvent implements ShouldBroadcast {
protected $value;
public function __construct($value){
$this->value = $value;
}
}
class TestResource extends Resource {}
// Somewhere in Your code
event( new TestEvent( TestResource::collection($anyCollectionObject) ) );
dispatch( new TestEvent( TestResource::collection($anyCollectionObject) ) );
Both calls to helpers will trigger exception: Serialization of 'class@anonymous' is not allowed. \Illuminate\Queue\Queue::createObjectPayload() - call serialize on anonymous class of collection.
The text was updated successfully, but these errors were encountered:
Description:
Cant pass resource collection to event classes as property, becouse serialization of 'class@anonymous' is not allowed.
Steps To Reproduce:
Create any event class.
Instantiate it with resource collection.
Try to fire event or dispath it.
In code
Both calls to helpers will trigger exception:
Serialization of 'class@anonymous' is not allowed
.\Illuminate\Queue\Queue::createObjectPayload()
- call serialize on anonymous class of collection.The text was updated successfully, but these errors were encountered: