How do I show my custom validation error messages? (And other questions) |
I'm trying to make a basic CRUD system.
I have a PostsController class: Code: <?php namespace App\Controllers; and my Post model: Code: <?php namespace App\Models; The main issue I have is that the custom error messages are not displayed when there is an error. It seems like the defaults. How do I get CI to use them? Also, in the PostsController class I use this a lot: PHP Code: $rules = $postModel->validationRules; Is there a way for CI to just know that the rules have been defined and to use them rather than calling $this->validate() and having to inject the rules anyway. Why define them in the model in the first place if that is the case. Additionally, there is a lot of code repetition in the PostsController class. Is that the CI way, or is there a way better way to keep things DRY? Finally, is the main dev team happy to accept pull requests? I would really like to contribute to the project and wondered if that is possible? I have the same question for CI3. Are you looking for maintainers for that codebase? I could make another post for that though.
SEE: CodeIgniter 4 User Guide - Working With Errors
For contributing SEE: CodeIgniter 4 GitHub Development Site SEE: In the file list CONTRIBUTING.md Displaying errors from the controller from Myth/Auth. PHP Code: // ERROR Hope that helps, I would download Myth/Auth and take a look at the code very good for learning how to do things. Download: Myth:Auth Take a good look at the Controller. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(08-14-2020, 09:05 AM)InsiteFX Wrote: SEE: CodeIgniter 4 User Guide - Working With Errors Sorry for my late reply! I wanted to say thank you for helping me out with this, I really appreciate it |
Welcome Guest, Not a member yet? Register Sign In |