Welcome Guest, Not a member yet? Register   Sign In
[split] CodeIgniter4 User Guide - tutorial
#1

(This post was last modified: 08-09-2018, 06:46 AM by ciadmin.)

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 ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB