What seems to be the problem:
I need to use a service to save a form.
I tried to declare the service in mount but that’s not accepted
public function mount(String $action, Content $content)
{
$this->contentArticleService = new ContentArticleService();
However if I declare it in a function it is fine
public function storeAndMakeLive()
{
$this->validate($this->rules, $this->messages);
$this->contentArticleService = new ContentArticleService();
$this->contentArticleService->storeAndMakeLive($this);
return redirect()->route('admin.contents.index');
}
Why can’t I declare it in the mount function? I think the error I got was that the type of $this->contentArticleService was not a Int, booloean, string …
Steps to Reproduce:
Are you using the latest version of Livewire:
yes
Do you have any screenshots or code examples: