mardi 1 août 2017

Laravel5.3:How to use pluck in relationship for bindign Form::select element?

this is my model

class Positions extends Model implements Repository
{
    protected $fillable = ['index_id', 'title', 'description'];
   public function index()
   {
       return $this->belongsTo('TEST\Indices', 'index_id');
   }
    public function getById($id)
    {
        return $this->with('index')->find($id);
    }
}

how to use pluck() in getById function for listing index relationship?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire