Support the ongoing development of Laravel.io →
Database Eloquent Packages
Last updated 2 years ago.
0

Do you have a model for both Suppliers and for Users? I'm having a hard time understanding your question, but you should be able to do something like this.

User Model:

class User extends Eloquent {

    protected $table = 'users';
    protected $primaryKey = 'userid';

}

Supplier Model

class Supplier extends Eloquent {

    protected $table = 'suppliers';
    protected $primaryKey = 'supplierid';

}

Then you will be able to use Model::find($id) or Model::findOrFail($id) to accomplish what you are doing. If you want to return specific columns, just end your method with

->lists('column1', 'column2');

If I am understanding your question correctly, that should do what you need it to.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.