shrooq
2 weeks ago

Show error message if value is there already

Posted 2 weeks ago by shrooq

Hi, This is my store function in the controller I want to say if the value of coursenum is exit before in my table don't store and show the message to inform the user to rewrite other value-

public function store(Request $request)
   {
$excuse->coursenum  = $request->input('coursenum ');
         if($requests = Student::where ( 'coursenum ', 'LIKE', '%' . coursenum  . '%' )
         {
           return ('the number is exit , write othe value');
         }
 return redirect('/students');
    }

Please sign in or create an account to participate in this conversation.