instead of this:
public function accept($user){
Do this:
public function accept($user = false){
By using $user = false
You don't need to add a variable to the function because if it not exists it will be false.
So now you can use these two methods to acces the function
accept();
//$user will be false in the function
and
$idUser = 1;
accept($idUser);
//$user will be 1 in the function
Also see for more information about isset()
, empty()
and !
this url: http://kunststube.net/isset/