2
    public function acceptpersonalvisitupdate(Request $request)
    {  $employeeinfo=$request->input('employeeinfo');
       $id=$request->input('id');
       $visitoremail=$request->input('visitoremail');
       $visitorname=$request->input('visitorname');
       $visitorphonenumber=$request->input('visitorphonenumber');
       $visitortype=$request->input('visitortype');
       $empname=$request->input('empname');
       $empdept=$request->input('empdept');
       $date=$request->input('date');
       $from=$request->input('from');
       $noofhours=$request->input('noofhours');


       Mail::send('mails.acceptedpersonalvisit',     
        ['visitorname'=>$visitorname,'visitorphonenumber'=>$visitorphonenumber,
                                              'visitoremail'=>$visitoremail,'id'=>$id,'visitortype'=>$visitortype,
                                              'empname'=>$empname,'empdept'=>$empdept,'date'=>$date,'from'=>$from,
                                              'noofhours'=>$noofhours,'employeeinfo'=>$employeeinfo],function($message)
   {
     $message->to($visitoremail,$visitorname))->subject('Personal Visit Request Accepted');
   });
   DB::update('update bookingtable set employeeinfo=?,staus="Approved" where id=?',[$employeeinfo,$id]);
   return Redirect::to('acceptedpersonalvisits')->with('success','Successfully Accepted Personal Book Request!!!');
}

In The Above Code i have a acceptpersonalvisitupdate post function.Its variables are those list of variables defined.From that variables i want to access $visitoremail and $visitorname in mail function.when i normally represent the variable it shows error as undefined variable $visitoremail.how to access that variable inside mail function.Any Help and suggestions are most welcome.Thank You.

1 Answer 1

3

Add the use():

function ($message) use($visitoremail, $visitorname) {
Sign up to request clarification or add additional context in comments.

1 Comment

It Worked.Thank you so much for your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.