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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community