Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to call Controller method from the Task
  • I'm building a cron job task and I need to call one of the Controllers methods. I'm trying to use: 

    $data = \Request::forge('controller/test')->execute()->response();

    but the Task just terminates after this call with no response.

    method in the controller: 

    public function action_test()
    {
    return 'test';
    }
  • Try

        echo 'test';


  • After

    $data = \Request::forge('controller/test')->execute()->response();

    your $data will contain a Response object. Anything the controller method has returned will be stored in the response body, accessable via $data->body().

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion