Do you have a '<mytable>' table on '<myconnect>' database?. Also, have you configured the '<myconnection>' connection?
Yes, table works in own model.
This echo -line, try find this Customers table from <default connection>'s database, not <myconnection>'s database. Why?
Im guessing that the customer data is being held on a different database to the reservations?
If that's so then you can try specifying the connection for that model explicity in the class. So in your Customer class, add this:
protected $connection = 'mysql';
make sure the connection name is correct according to your database configuration, then laravel should select customers using the correct connection.
I haven't tried this myself, but it should work i think :/
Tables Reservations and Customers are at same database. I can't define protected $connection because, connection is different at different cases.
Ruk33 said:
Have you tried with setConnection ?
Same problem
More Infomartion:
var_dump($res);
["connection":protected]=> string(8) "myconnect"
BUT
var_dump($res->customer);
["connection":protected]=> NULL
So if I use customer method in reservations model, connection is NULL and Laravel connect with default connection, not <myconnection> what I defined.
Is this bug or my dumbness?
If somebody resolve this, I will pay 20$ with Paypal :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community