Ad

Laravel Stop Registration From Admin Panel

I building settings page where the admin can change some setting in the website I want to add an option to stop registration

for example:

if registration is disabled and a user trying to go to register page he will automatically redirect to 404

Setting Table:

Name: The Name of option or setting

Value: The value (if this value = 0 that means this option is disabled and if it's 1 that means it's enabled)

I already add a column in setting table "stop_register"

what I want is when the value of this column is 0 then registration is off and when it's 1 then the registration is on

Ad

Answer

try this version:

public function Register()
{
  $stop_reg = DB::table('settingstable')->value('stop_register');
  if( $stop_reg==1 )
   {
     return view('register_page');
   }
  elseif( $stop_reg==0 )
   {
     return view('404_page');
   }

}
Ad
source: stackoverflow.com
Ad