Solution for laravel v5.7 and above
class Album extends Eloquent {
// default connection
public function genre() {
return $this->setConnection('Resources')->belongsTo('genre');
}
...
}
More Related Contents:
- how to convert query php to laravel framework
- How to fetch data from multiple table according to id by using query builder in laravel
- Laravel redirect back to original destination after login
- Migration: Cannot add foreign key constraint
- Laravel 5.6 – Passport JWT httponly cookie SPA authentication for self consuming API?
- Laravel migration: “Foreign key constraint is incorrectly formed” (errno 150)
- Add new methods to a resource controller in Laravel
- How can I resolve “Your requirements could not be resolved to an installable set of packages” error?
- Laravel Redirect Back with() Message
- How to keep Laravel Queue system running on server
- Eloquent eager load Order by
- How to include a sub-view in Blade templates?
- Laravel Fluent Query Builder Join with subquery
- Laravel Migration Change to Make a Column Nullable
- Laravel Controller Subfolder routing
- Allowed memory size of 536870912 bytes exhausted in Laravel
- “Please provide a valid cache path” error in laravel
- Best Practices for Laravel 4 Helpers and Basic Functions?
- Laravel showing “Failed to clear cache. Make sure you have the appropriate permissions”
- Including a css file in a blade template?
- Artisan command “make:auth” is not defined in Laravel 6
- Vue.js – validation fails for file upload in axios when multipart/form-data used in header
- How to change value of a request parameter in laravel
- Laravel save / update many to many relationship
- How to fix the error “You may need an appropriate loader to handle this file type”
- I’m getting error “Class ‘Predis\Client’ not found” in Laravel 5.2
- Error Field doesn’t have a default value in laravel 5.3
- Laravel 4 : Route to localhost/controller/action
- laravel migration best way to add foreign key
- Install vue 3.0 in laravel