Skip to content

Commit

Permalink
Added a note about binary data
Browse files Browse the repository at this point in the history
  • Loading branch information
danmatthews authored Sep 7, 2016
1 parent cc2f5a3 commit 6874761
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Job classes are very simple, normally containing only a `handle` method which is

In this example, note that we were able to pass an [Eloquent model](/docs/{{version}}/eloquent) directly into the queued job's constructor. Because of the `SerializesModels` trait that the job is using, Eloquent models will be gracefully serialized and unserialized when the job is processing. If your queued job accepts an Eloquent model in its constructor, only the identifier for the model will be serialized onto the queue. When the job is actually handled, the queue system will automatically re-retrieve the full model instance from the database. It's all totally transparent to your application and prevents issues that can arise from serializing full Eloquent model instances.

{note} Binary data, such as image files opened using `file_get_contents` or similar, is not supported by queue classes and must be encoded first using an appropriate method such as `base64_encode()`

The `handle` method is called when the job is processed by the queue. Note that we are able to type-hint dependencies on the `handle` method of the job. The Laravel [service container](/docs/{{version}}/container) automatically injects these dependencies.

<a name="dispatching-jobs"></a>
Expand Down

0 comments on commit 6874761

Please sign in to comment.