Hi all, I like to build a simple Linklist plugin for a local club here. i have a Categories and a Links table, they are in relation with a pivot table so i can handle one link in multiple categories. now i have a component that is placed in a partial file (two separete partial files) to use the component twice if needed.
on my Link List Page i like to show now all Links in the Categories - but w/o the links from one specific cat. i.e the category "frontpage"
`
protected function loadCategories()
{
$query = Category::active()->with('links')->get();
/*
*
* Show a specific Category
*
*/
if( $this->property('cat_slug') <> 'all' ) {
$query = $query->where('slug', $this->property('cat_slug') )
->take($this->property('results'));
}
/*
*
* Show all Categories
* but NOT the one selected as 'exclude...'
*
*/
if( $this->property('exclude_cat') == 'frontpage') {
$query = $query->where('slug' , '<>', 'frontpage' )->take($this->property('results'));
return $query;
}
return $query;
}
` this returns nothing.... too bad.
now when i use the php code block on a testpage like this here:
<? use Alex\Linklist\Models\Category; function onStart(){
$this['categories'] = Category::where('slug', '<>', 'frontpage')->with('links')->get();
}
?> ` it works as expected.
what am i doing wrong here ? thank you for your help