lundi 13 février 2017

Backpack Laravel - How do I redirect a page to home?

Vote count: 0

I use Backpackforlaravel to create my site.

In the "PageManager" package I can add pages via the administration. Only, I would like to manage a page as the home page of my site. When I create one, it returns to mywebsite/homepage and not to mywebsite/.

Here is my function in PageController for PageManager

public function index($slug)
{
    $page = Page::findBySlug($slug);

    if (!$page)
    {
        abort(404, 'Please go back to our homepage.');
    }

    $this->data['title'] = $page->title;
    $this->data['page'] = $page->withFakes();

    return view('pages.'.$page->template, $this->data);
} 

And my routes to catch-all routes for Backpack PageManager

Route::get('{page}/{subs?}', ['uses' => 'PageController@index'])
 ->where(['page' => '^((?!admin).)*$', 'subs' => '.*']);

I started in Laravel. I hope you can help me understand.

thank you very much

asked 22 secs ago

Let's block ads! (Why?)



Backpack Laravel - How do I redirect a page to home?

Aucun commentaire:

Enregistrer un commentaire