11 months ago

How do I display only eloquent related data in blade file

Posted 11 months ago by kuns25

Hii ,

    I Have two models 1) HealthPackage 2) Category .

Health Package table have many healthpackages and categories table have Popular & Trending categories .

Now ive assigned popular Category to some HealthPackages via many to many relationship.

Now in my popular blade file , i want to show healthpackages which are related to only popular category.

how do i pass value in my controller .

For e.g generally we do

$healthpackage = healthpackage::all();

// This is displaying all the health pacakage but i want only healthpackages with popular category assigned to them .

Note: My Eloquent relationship is completed working fine ,Checked in tinker and database as well.

please help me stucked from hrs in this .

Thanks in Advance .

Please sign in or create an account to participate in this conversation.