Change default login pages from admin panel in Laravel -
i have admin panel has various function. there 2 login forms on front end of site:
the default login form http://example.com/login
there button on user can click if he/she want use second login form.
those routes them
route::get ('/users/login', ['uses' => 'userscontroller@login', 'before' => 'guest']); route::get ('/users/no_login', ['uses' => 'userscontroller@no_login', 'before' => 'guest']);
what options have switcher in admin panel can switch default page login page e.g. switch between login
, login2
. if put them in database need change in routes current active form or there way?
edit
public function login() { $login = preferences::all(); if ($login->preferences_login == 0){ return view::make('users.login'); } return view::make('users.no_login'); }
error
undefined property: illuminate\database\eloquent\collection::$preferences_login
well can solve in various ways.
like said in admin panel make link switch value in db , need have 1 route in routes/web.php
route::get ('/users/login', ['uses' => 'userscontroller@login', 'before' => 'guest']);
and in controller function login() can check
if ($db_value == 1){ return view('login'); } else { return view('no_login'); }
and return corresponding view
or make variable in .env file
app_flavour=your_flavour
and check in controller
if (env('app_flavour') == your_flavour){ return view('login'); } else { return view('no_login'); }
but 1 more fix value if won't change often.
Comments
Post a Comment