CodeIgniter Forums

Full Version: [split] CodeIgniter4 User Guide - tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I'm reading this guide, trying tutorial samples and with "Create new item", i got an error with this controller code

public function create()
{
   helper('form');
   $model = new NewsModel();

   if (! $this->validate($this->request, [
       'title' => 'required|min[3]|max[255]',
       'text'  => 'required'
   ]))
   {

validate function DOES NOT need $this->request, but waits for $rules and $messages

according to me, sample code should be 
if (! $this->validate([
       'title' => 'required|min[3]|max[255]',
       'text'  => 'required'
   ]))
   {


Am I right ?