Welcome Guest, Not a member yet? Register   Sign In
ResourcePresenter vs ResourceController
#1

Hello, 
I am using CodeIgniter 4 for some time now and I like it a lot but I have one question that I couldn't find an answer for.
What is the actual difference between ResourcePresenter and ResourceController and when should they be used?  

I have some knowledge about but I'd like to confront it with someone else to know whether I'm correct or wrong.
So, as I understood from the docs, ResourceController returns HTTP status codes and processes the request while ResourcePresenter can display views and process the request too (remove, create).

Right now in my ResourceController I have an example code like this:
PHP Code:
public function create()
    {
       
// Do some stuff

       // Set flashdata
           
return redirect()->back();

    } 

Is the above code a correct approach?
Reply
#2

I have the same question. If resource controller is for API only, and resource presenter is for API and show Views. How to use the new() function in API. I think, in ResourcePresenter, it s can be used to show a new() form. But, in API, how to use it, without a view?  Huh Huh
Reply




Theme © iAndrew 2016 - Forum software by © MyBB