| 1 | <?php |
||
| 9 | class NewsService extends CRUDServices |
||
| 10 | { |
||
| 11 | use FileTraits; |
||
| 12 | /** |
||
| 13 | * @var News |
||
| 14 | */ |
||
| 15 | private $news; |
||
| 16 | |||
| 17 | public function __construct(News $news) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return News |
||
| 28 | */ |
||
| 29 | public function getNews(): News |
||
| 33 | |||
| 34 | /** |
||
| 35 | * This sets the attributes to be removed from the given set for updating or creating. |
||
| 36 | * @return mixed |
||
| 37 | */ |
||
| 38 | public function getUnsetFields() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * This get the model value or class of the model in the service. |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function getModel() |
||
| 51 | |||
| 52 | public function getParentRelationship() |
||
| 56 | } |
||
| 57 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: