Open drjoju opened 5 years ago
Hey @drjoju! I have the same problem and I wonder how did you solve this issue?
use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; use Illuminate\Support\Facades\Facade; $capsule = new Capsule;
$capsule->addConnection([ 'driver' => DBDRIVER, 'host' => DB_SERVER, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASS, 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => PREFIX, ]);
// Set the event dispatcher used by Eloquent models... (optional)
$capsule->setEventDispatcher(new Dispatcher(new Container));
// Make this Capsule instance available globally via static methods... (optional) $capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) $capsule->bootEloquent();
$database = new Capsule(); $db = & $database;
Global $database; $database->table('users')->where('votes', '>', 100)->get(); or you can make model User::find(1)-get();
Hello,
I'm trying to add a database connection to Queue component. Something like:
I created the table like Laravel does. I'm trying to do the same as Laravel, that is,
WorklistOrderJob :: dispatch ($order);
with this codeWhere Orden is a Eloquent Model.
My goal is to insert in the database the instance of the model so another application in Laravel consumes the model inserted in the Jobs table. I can see the model in the database but when I call
an error appears "Call to undefined method fire".
When I add fire method to the Job the database entrance is procesed.
Why fire thas not exists? Laravel is in version 5.7 and I'm using Torch 5.5. Incompatibilty problem? Is it correct what I am saying?
Any suggestions or comments are welcomed.
Thanks in advance