Extra menu-items uit site_menu tabel in database
This commit is contained in:
30
api/app/Http/Controllers/MenuController.php
Normal file
30
api/app/Http/Controllers/MenuController.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class MenuController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function special()
|
||||||
|
{
|
||||||
|
$query = app('db')->select('SELECT id, title, link, is_special FROM site_menu WHERE ((visible_from IS NULL AND visible_to IS NULL) OR (visible_from <= NOW() AND visible_to >= NOW()))');
|
||||||
|
$items = [];
|
||||||
|
foreach($query as $item)
|
||||||
|
{
|
||||||
|
$items[$item->id] = ['title' => $item->title, 'link' => $item->link, 'special' => $item->is_special];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,8 @@ $app->get('/', function () use ($app) {
|
|||||||
return redirect('docs');
|
return redirect('docs');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$app->get( 'menu/special', 'MenuController@special' );
|
||||||
|
|
||||||
$app->get('nieuws/overzicht', 'NewsController@newslist' );
|
$app->get('nieuws/overzicht', 'NewsController@newslist' );
|
||||||
$app->get('nieuws/regio/{region:[a-z0-9-]+}', 'NewsController@regionlist' );
|
$app->get('nieuws/regio/{region:[a-z0-9-]+}', 'NewsController@regionlist' );
|
||||||
$app->get('nieuws/thema/{theme:[a-z0-9-]+}', 'NewsController@themelist' );
|
$app->get('nieuws/thema/{theme:[a-z0-9-]+}', 'NewsController@themelist' );
|
||||||
|
|||||||
Reference in New Issue
Block a user