coderflexx / laravel-ticket

Laravel Ticket System, to help you manage your tickets easily.
https://coderflex.com/open-source/docs/laravel-ticket/introduction
MIT License
361 stars 70 forks source link

MongoDB not supported #20

Open maciejstepie opened 1 year ago

maciejstepie commented 1 year ago

In the Ticket model is use Illuminate\Database\Eloquent\Model but it won't work with relations to create tickets on users. It will throw an error Call to a member function prepare() on null It has to be use Jenssegers\Mongodb\Eloquent\Model.

Please add option to support mongoDB connection.

ousid commented 1 year ago

Did you add a mongodb configuration in config/databas.php in your laravel app?

Try to extend the Ticket Model, and alter the $connection property.

class Ticket extends \Coderflex\LaravelTicket\Models\Ticket
{
  protected $connection = 'mongodb';

 //
}

Because I'm not sure, on how to add a DB connection support into the package exactly, if the above solution does not work, feel free to open a PR, and I'll check it ASAP.

Thanks!