Click here to Skip to main content
15,446,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public function register_new_member(Request $request)
{

$user =new User;
$sponsor=User::where('username',$request['sponsor']);
$user->username=$request['username'];
$user->fName=$request['fName'];
$user->lName=$request['lName'];
$user->gender=$request['gender'];
$user->mobile_number=$request['phone'];
$user->join_date=date('Y-m-d');
if($this->check_under_user($sponsor->id)==false){
session(['status'=>'fail_admin']);
session(['message'=>'Can not register new member! You exceeded system depth']);
return view('pages.admin.registration.register');
}
else{
$value=$this->check_under_user($sponsor->id);
$user->upline_id=$value["upline_id"];
$user->sameline_no=$value["sameline_no"];
$user->level_no=$value["level_no"];
$user->path=User::where('id',$value["upline_id"])->first()->path.$value["sameline_no"];
$user->email=$request['email'];
$user->country=$request['country'];
$user->state=$request['state'];
$user->address=$request['address'];
$user->zip_code=$request['zipcode'];
$user->city=$request['city'];
$user->password=bcrypt($request['password']);

$user->save();

return view('pages.admin.genealogy.matrix');
}
}

What I have tried:

it is giving me this error:
Undefined property: Illuminate\Database\Eloquent\Builder::$id

I have tried using get() and first() but it's still showing me error:
Trying to get property 'id' of non-object
Posted
Comments
Richard MacCutchan 5-Jul-22 9:50am    
Which line does the first error occur on? The second error suggests that $sponsor is null.
Zeddicus Zu'l 5-Jul-22 10:00am    
on the second line sir..
Richard MacCutchan 5-Jul-22 10:06am     CRLF
The second line contains a single character:
{
Here is a suggestion: we have no idea what you are doing or trying to do, we cannot see your screen or read your mind. So you need to provide a complete detailed explanation of what is happening, or not happening, in order for us to help you.
Zeddicus Zu'l 5-Jul-22 10:33am     CRLF
you mean I should add the curled brackets to it?
Richard MacCutchan 5-Jul-22 10:49am    
Please read again the last two sentences in my previous comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900