Laravel Stop Registration from admin panel

Hamad Essa :

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

Julius Fasema :

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');
   }

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=27818&siteId=1