Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Saturday at 9:50 AM
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Wednesday at 11:57 AM
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Ad icon
Colombo
Hard Disk For Sale
mazza
Updated:
Oct 10, 2026
land for sale
justasking
Updated:
Oct 10, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Laravel & sql project help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="isurutmv" data-source="post: 23022896" data-attributes="member: 470006"><p><span style="font-size: 18px">mekayi mcn seen eka database eke table tikak thiyenawa me widihata</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><ul> <li data-xf-list-type="ul"><span style="font-size: 18px">distric</span></li> <li data-xf-list-type="ul"><span style="font-size: 18px">distric-town</span></li> <li data-xf-list-type="ul"><span style="font-size: 18px">ads</span></li> <li data-xf-list-type="ul"><span style="font-size: 18px">ads-catagory</span></li> </ul><p><span style="font-size: 18px">meke distric kiyana table eke thiyenne distric_id & distric_name</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">meke distric-town kiyana table eke thiyenne distric_id,town_id,town_name</span></p><p></p><p></p><p><span style="font-size: 18px">ads kiyana table eke ad_id,ad_name,.....,town_id kiyala thiyenawa</span></p><p></p><p></p><p><span style="font-size: 18px">ads_category eke ad_id,category_id,category_name kiyala thiyenawa</span></p><p></p><p></p><p><span style="font-size: 18px">ethakota mcn man hadana app eke user select karanne distric eka user distric eka select karama ee distric ekata adala town tika distric_town table eken aragena ee town walata adaala ads tika ads table eken filter karala ganna oone ieetapasse ee filter wela ena ads tiken </span><span style="font-size: 18px">category_id=5567 wechcha ads tika witharak filter karala userta pennanna oone</span></p><p></p><p></p><p><span style="font-size: 18px">man danata meka karala thiyenne me widihata bn</span></p><p></p><p></p><p><strong>distric model</strong></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>class district extends Model</strong></p><p><strong>{ </strong></p><p><strong>protected $table = 'district';</strong></p><p><strong></strong></p><p><strong> public function area_list()</strong></p><p><strong> { </strong></p><p><strong> return $this->hasMany(district_town::class);</strong></p><p><strong> }</strong></p><p><strong>}</strong></p><p><strong>[/PHP]</strong></p><p></p><p><strong>distric_town model</strong></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>class district_town extends Model</strong></p><p><strong>{ </strong></p><p> <strong>protected $table = 'district_town';</strong></p><p><strong></strong></p><p><strong> public function district() </strong></p><p><strong> { </strong></p><p> <strong>return $this->belongsTo(district::class);</strong></p><p><strong> }</strong></p><p><strong> public function ads() </strong></p><p><strong> { </strong></p><p><strong> return $this->hasMany(ads::class, 'town_id', 'id');</strong></p><p><strong> }</strong></p><p><strong></strong></p><p><strong>}</strong></p><p><strong>[/PHP]</strong></p><p></p><p><strong>ads_catagory model</strong></p><p></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>class ads_category extends Model</strong></p><p><strong>{ </strong></p><p><strong>protected $table = 'ads_category';</strong></p><p><strong></strong></p><p><strong> public function ads() </strong></p><p><strong> { </strong></p><p><strong> return $this->hasMany(ads::class,'ad_id','ad_id'); </strong></p><p><strong> }</strong></p><p><strong>}</strong></p><p><strong></strong></p><p><strong>[/PHP]</strong></p><p></p><p></p><p><strong>ads model </strong></p><p><strong></strong></p><p></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>class ads extends Model</strong></p><p><strong>{ </strong></p><p><strong>protected $table = 'ads'; </strong></p><p> <strong>protected $primaryKey = 'ad_id'; </strong></p><p><strong>public $incrementing = false;</strong></p><p><strong></strong></p><p><strong> public function ads_category() </strong></p><p> <strong>{ </strong></p><p> <strong>return $this->hasMany(ads_category::class,'ad_id','ad_id'); </strong></p><p><strong> }</strong></p><p><strong> public function area_list() </strong></p><p> <strong>{ </strong></p><p> <strong>return $this->belongsTo(area_list::class, 'id', 'business_city_id'); </strong></p><p><strong> }</strong></p><p><strong>}</strong></p><p><strong>[/PHP]</strong></p><p></p><p><strong>controller eka</strong></p><p></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>public function distric($id) </strong></p><p><strong> { </strong></p><p><strong> $distric = district::find($id); </strong></p><p><strong> return view('ads',compact('distric'));</strong></p><p><strong> }</strong></p><p><strong></strong></p><p><strong>[/PHP]</strong></p><p></p><p><strong>view eka</strong></p><p></p><p><strong>[PHP]</strong></p><p><strong></strong></p><p><strong></strong></p><p><strong>foreach($distric->distric_town as $distric_town) </strong></p><p> <strong>{</strong></p><p> <strong>foreach($distric_town->ads as $ads) </strong></p><p><strong> { </strong></p><p><strong>foreach($ads->ads_category as $ads_category) </strong></p><p><strong> { </strong></p><p> <strong>if($ads_category->sub_category_id == '557057') </strong></p><p><strong> {</strong></p><p><strong> //display ads</strong></p><p><strong></strong></p><p><strong> } </strong></p><p><strong> } </strong></p><p><strong> }</strong></p><p><strong> }</strong></p><p><strong>[/PHP]</strong></p><p></p><p></p><p><span style="font-size: 18px">meken mata oone wade wenawa bn eeth me widiata loop thunak yana eka sahenna awul meka me widihata nathuwa karanna wena widihak nadda bn <img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /></span></p></blockquote><p></p>
[QUOTE="isurutmv, post: 23022896, member: 470006"] [SIZE=5]mekayi mcn seen eka database eke table tikak thiyenawa me widihata [/SIZE] [LIST] [*][SIZE=5]distric[/SIZE] [*][SIZE=5]distric-town[/SIZE] [*][SIZE=5]ads[/SIZE] [*][SIZE=5]ads-catagory[/SIZE] [/LIST] [SIZE=5]meke distric kiyana table eke thiyenne distric_id & distric_name[/SIZE] [SIZE=5] [/SIZE] [SIZE=5]meke distric-town kiyana table eke thiyenne distric_id,town_id,town_name[/SIZE] [SIZE=5]ads kiyana table eke ad_id,ad_name,.....,town_id kiyala thiyenawa[/SIZE] [SIZE=5]ads_category eke ad_id,category_id,category_name kiyala thiyenawa[/SIZE] [SIZE=5]ethakota mcn man hadana app eke user select karanne distric eka user distric eka select karama ee distric ekata adala town tika distric_town table eken aragena ee town walata adaala ads tika ads table eken filter karala ganna oone ieetapasse ee filter wela ena ads tiken [/SIZE][SIZE=5]category_id=5567 wechcha ads tika witharak filter karala userta pennanna oone[/SIZE] [SIZE=5]man danata meka karala thiyenne me widihata bn[/SIZE] [B]distric model[/B] [B][PHP] class district extends Model { protected $table = 'district'; public function area_list() { return $this->hasMany(district_town::class); } } [/PHP][/B] [B]distric_town model[/B] [B][PHP] class district_town extends Model { protected $table = 'district_town'; public function district() { return $this->belongsTo(district::class); } public function ads() { return $this->hasMany(ads::class, 'town_id', 'id'); } } [/PHP][/B] [B]ads_catagory model[/B] [B][PHP] class ads_category extends Model { protected $table = 'ads_category'; public function ads() { return $this->hasMany(ads::class,'ad_id','ad_id'); } } [/PHP][/B] [B]ads model [/B] [B][PHP] class ads extends Model { protected $table = 'ads'; protected $primaryKey = 'ad_id'; public $incrementing = false; public function ads_category() { return $this->hasMany(ads_category::class,'ad_id','ad_id'); } public function area_list() { return $this->belongsTo(area_list::class, 'id', 'business_city_id'); } } [/PHP][/B] [B]controller eka[/B] [B][PHP] public function distric($id) { $distric = district::find($id); return view('ads',compact('distric')); } [/PHP][/B] [B]view eka[/B] [B][PHP] foreach($distric->distric_town as $distric_town) { foreach($distric_town->ads as $ads) { foreach($ads->ads_category as $ads_category) { if($ads_category->sub_category_id == '557057') { //display ads } } } } [/PHP][/B] [SIZE=5]meken mata oone wade wenawa bn eeth me widiata loop thunak yana eka sahenna awul meka me widihata nathuwa karanna wena widihak nadda bn :confused::confused::confused::confused::confused:[/SIZE] [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom