Do you have all the other "use" statements like
<?php
namespace App\Http\Controllers;
use Validator;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everyone,
When I try to submit a new discussion I receive this error:
FatalThrowableError in ChatterBeforeNewDiscussion.php line 26:
Type error: Argument 2 passed to DevDojo\Chatter\Events\ChatterBeforeNewDiscussion::__construct() must be an instance of Illuminate\Support\Facades\Validator, instance of Illuminate\Validation\Validator given, called in /var/www/vhosts/domain/httpdocs/vendor/devdojo/chatter/src/Controllers/ChatterDiscussionController.php on line 66
ChatterBeforeNewDiscussion.php line 26
use Validator;
...
public function __construct(Request $request, Validator $validator)
{
// no error message if I comment out the following lines
$this->request = $request;
$this->validator = $validator;
}
ChatterDiscussionController.php on line 66
use Validator;
...
$validator = Validator::make($request->all(), [
'title' => 'required|min:5|max:255',
'body_content' => 'required|min:10',
'chatter_category_id' => 'required',
]);
Event::fire(new ChatterBeforeNewDiscussion($request, $validator));
Am I doing anything wrong here? The second argument seems to be an instance of Illuminate\Support\Facades\Validator so I don't really understand this error message. :-(
Any help is appreciated!
Please or to participate in this conversation.