Show gantt chart refer to project id using laravel connector

Greetings, currently i have integrate dhtmlx gantt in Laravel using laravel connector. I have followed this guide and it works. [url]http://docs.dhtmlx.com/tutorials__connector_laravel__step6.html[/url].

Now, What I am trying to do, is to show gantt chart refer to project id, so I tried use query in GanttController. But I receive a blank gantt table. Is the query correct? If no,please guide me to debug this error. I have included the snippet and screenshot. Thanks

<?php
namespace App\Http\Controllers;
use App\GanttTask;
use App\GanttLink;
use Dhtmlx\Connector\GanttConnector;

class GanttController extends Controller
{
    public function data() {
        $connector = new GanttConnector(null, "PHPLaravel");
        $connector->render_links(new GanttLink(), "id", "source,target,type");
        
        $connector->render_table( 
           GanttTask::where('project_id','=',2)->get(),
           "id",
           "start_date,duration,text,progress,parent,project_id"
        );
    }

}


Hi,
there are no obvious issues with your code.
Try enabling connector logging, it may give a clue docs.dhtmlx.com/connector__php__errors.html

Also, make sure that you’ve set a format for dates on a client side
docs.dhtmlx.com/gantt/api__gantt … onfig.html

Hi thanks for reply. I have enable the log, but where I can find the logfile that create from dhmtlx gantt plugin.However,I received an error where I check in localhost:8000/gantt_data .

ErrorException in PHPLaravelDBDataWrapper.php line 14:
Non-static method Illuminate\Support\Collection::all() should not be called statically, assuming $this from incompatible context

Can I get guide on debug this error?


Anybody can help me?

Hi,

Please try to update connector from the github, it already contains a fix for the issue.

github.com/DHTMLX/connector-php/tree/modern

Thank You for reply, just updated with latest bug fix using “composer update” and it works.
But I have a doubt, does this where() method works also if we add new task/ edit a task?

Because I have added a new task,but it is not saved in the database.

It only save into database when i remove this code

  $connector->render_table(                                  
	 GanttTask::where('project_id', '=', 2)->get(),
	 "id",                                                               
	"start_date,duration,text,progress,parent,project_id"                      
  );

and replace with this code

$connector->render_table(new GanttTask(),"id","start_date,duration,text,progress,parent");

Thanks