From f3c8430034da85a04394d40eae2eec4007cf562e Mon Sep 17 00:00:00 2001 From: Jason Judge Date: Tue, 28 Mar 2023 16:48:02 +0100 Subject: [PATCH] Provide an example of @mixin Just discovered these, and they make working on a presenter very much easier, as it sees `$this` as your model, just as happens at run-time. A single presenter could conceivably be used by multiple models, but I think this will be rare, since each model will likely be different, and each can have onle one presenter. --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2705cef..e9418a9 100644 --- a/readme.md +++ b/readme.md @@ -24,10 +24,12 @@ Pull this package in through Composer. The first step is to store your presenters somewhere - anywhere. These will be simple objects that do nothing more than format data, as required. Here's an example of a presenter. +The `@mixin`, when it points to your model, provides autocompletion on `$this` in your IDE. ```php use Laracasts\Presenter\Presenter; +/** @mixin \User */ class UserPresenter extends Presenter { public function fullName() @@ -71,4 +73,4 @@ Notice how the call to the `present()` method (which will return your new or cac Have fun! -Jeffrey @ [https://laracasts.com](https://laracasts.com) \ No newline at end of file +Jeffrey @ [https://laracasts.com](https://laracasts.com)