0
Good evening friends,
I’m having a problem, when I try to pass the variables from one control to the other, he ends up accusing that the variable "was not defined":
(Undefined variable: Black and white)
I don’t know what I’m doing wrong, could anyone help me? I need a light rsrs...
Schedulecontroller.php
use App\Schedule;
use App\Mail\AgendamentoEpcSup;
use Illuminate\Support\Facades\Mail;
public function store(Request $request)
{
$schedule = New Schedule();
$schedule->user_id = $request -> input('user_id');
$schedule->room_id = $request -> input('room_id');
$data_str = \DateTime::createFromFormat('d-m-Y', $request-> input ('date_choice'));
$schedule->date = $data_str->format('Y-m-d');
$schedule->hour_in = $request-> input('hour_in');
$schedule->hour_out = $request-> input('hour_out');
$schedule->save();
$user = Auth::user();
$user_email = Auth::user()->email;
Mail::to($user_email)->send(new AgendamentoEpcSup($schedule, $user));
return redirect()->route('schedules.index')->with('status', 'Novo agendamento criado, lembrando que cancelamentos só podem ser feitos com 12h de antecedência pelo sistema.');
}
Scheduling epcsup.php
namespace App\Mail;
use App\User;
use App\Schedule;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class AgendamentoEpcSup extends Mailable
{
use Queueable, SerializesModels;
public $schedule;
public $user;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
$this->schedule = $schedule;
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.agendamento', compact('schedule', 'user'));
}
}
I don’t know why the values aren’t being passed :/
Thank you so much!
Noooooossa I deserved HAHAHAHAHHAHAHA... Worse than I have reviewed it 10 times and for me it was ok... Tired mind is complicated... But thank you for the help... Possibly I would be questioning me so far rsrs... In my head, as I had already stated public $Schedule;, I was thinking that the $this-> was already pulling the values HAHAHHAHAHA... Wow, really worth...
– Ursones