dhtmlxScheduler And Laravel


#1

Hello Friends…
I want to retrieve data from a database table with ‘WHERE’ clause.But its not working. Please help me out.

public function data() {
$connector = new SchedulerConnector(null, “PHPLaravel”);

    $connector->configure(new MyModel(), "event_id", "start_date, end_date, event_name, details");
    $connector->render();
}

The above code returns all the values from the table ‘event_table’.
****But i want to execute the below codes-----

public function data() {
$connector = new SchedulerConnector(null, “PHPLaravel”);

    $connector->configure(
        MyModel::where(user_id','=',1)->get(),
        "event_id",
        "start_date, end_date, event_name, details"
    );
    $connector->render();
}

#2

Hi,

The second snippet is a valid one and must work correctly.
Connector accepts both the Model class and result of custom find call

Do you have some kind of PHP error or just an empty output for the second snippet ?


#3

In my case an window popped-up and inside the tag following errors occur----

Whoops, looks like something went wrong.

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

  1. in PHPLaravelDBDataWrapper.php line 14
  2. at HandleExceptions- >handleError('2048', 'Non-static method Illuminate\Support\Collection::all() should not be called statically , assuming $this from incompatible context', 'C:\xampp\htdocs\laravel\vendor\dhtmlx\connector-php\codebase \Dhtmlx\Connector\DataStorage\PHPLaravelDBDataWrapper.php', '14', array('source' => object (DataRequestConfig), 'sourceData' => object(Collection), 'className' => 'Illuminate\Database\Eloquent\Collection')) in PHPLaravelDBDataWrapper.php line 14
  3. at PHPLaravelDBDataWrapper ->select(object(DataRequestConfig )) in Connector .php line 274
  4. at Connector->get_resource() in Connector.php line 254
  5. at Connector->render() in networksController.php line 572
  6. at networksController->data('1' )
  7. at call_user_func_array(array(object(networksController), 'data'), array('id' => '1' )) in Controller.php line 256
  8. at Controller->callAction('data', array ('id' => '1')) in ControllerDispatcher.php line 164
  9. at ControllerDispatcher->call (object(networksController), object(Route), 'data') in ControllerDispatcher.php line 112
  10. at ControllerDispatcher->Illuminate \Routing\{closure}(object(Request))
  11. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
  12. at Pipeline->Illuminate\Pipeline\{closure }(object(Request))
  13. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  14. at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
  15. at ControllerDispatcher->callWithinStack (object(networksController), object(Route), object(Request), 'data') in ControllerDispatcher.php line 69
  16. at ControllerDispatcher->dispatch (object(Route), object(Request), 'App\Http\Controllers\networksController', 'data') in Route.php line 201
  17. at Route->runWithCustomDispatcher(object (Request)) in Route.php line 134
  18. at Route->run(object(Request)) in Router.php line 704
  19. at Router->Illuminate\Routing\{closure}(object(Request))
  20. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
  21. at Pipeline->Illuminate\Pipeline\{closure }(object(Request))
  22. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  23. at Pipeline->then(object(Closure)) in Router.php line 706
  24. at Router->runRouteWithinStack(object< /em>(Route), object(Request)) in Router.php line 671
  25. at Router->dispatchToRoute(object (Request)) in Router.php line 631
  26. at Router->dispatch(object(Request)) in Kernel.php line 236
  27. at Kernel->Illuminate\Foundation\Http \{closure}(object(Request))
  28. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
  29. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in VerifyCsrfToken.php line 50
  30. at VerifyCsrfToken->handle(object(Request), object(Closure))
  31. at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object (Request), object(Closure ))) in Pipeline.php line 124
  32. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in ShareErrorsFromSession.php line 49
  33. at ShareErrorsFromSession ->handle(object(Request), object(Closure))
  34. at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline .php line 124
  35. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in StartSession.php line 62
  36. at StartSession->handle(object(Request), object(Closure))
  37. at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  38. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in AddQueuedCookiesToResponse .php line 37
  39. at AddQueuedCookiesToResponse ->handle(object(Request), object(Closure))
  40. at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array (object(Request), object(Closure))) in Pipeline.php line 124
  41. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in EncryptCookies.php line 59
  42. at EncryptCookies->handle (object(Request), object(Closure))
  43. at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  44. at Pipeline->Illuminate\Pipeline\{closure }(object(Request)) in CheckForMaintenanceMode .php line 42
  45. at CheckForMaintenanceMode ->handle(object(Request), object(Closure))
  46. at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  47. at Pipeline->Illuminate\Pipeline\{closure }(object(Request))
  48. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  49. at Pipeline->then(object(Closure)) in Kernel.php line 122
  50. at Kernel->sendRequestThroughRouter (object(Request)) in Kernel.php line 87
  51. at Kernel->handle(object( Request)) in index.php line 54
        </div>
</body>

#4

Hi,

Please try to update Dhtmlx\Connector\DataStorage\PHPLaravelDBDataWrapper.php with the attached one.
PHPLaravelDBDataWrapper.zip (880 Bytes)


#5

Thank u so much…its working now…


#6

In case of add new event it shows below errors----

Whoops, looks like something went wrong.

1/1 FatalErrorException in PHPLaravelDBDataWrapper.php line 33: Call to undefined method Illuminate\Database \Eloquent\Collection::create()

  1. in PHPLaravelDBDataWrapper.php line 33
        </div>
</body>

***Also it fails to update any events… :frowning:


#7

hello guys,

How to add a new event with fixed values.