I'm working right now with a Laravel 5.1, for some reason my code, even thou it looks fine, doesn't work properly. I'm trying to make my app send an email with a view as a message.
public function sale(Request $request, $id)
{
$laptops = Laptops::findOrFail($id);
$name = Input::get('usr');
$lname = Input::get('lname');
$email = Input::get('email');
$city = Input::get('city');
$street = Input::get('street');
$houseNr = Input::get('houseNr');
$postCode = Input::get('postCode');
$telephone = Input::get('telephone');
$dCity = Input::get('deliveryCity');
$dStreet = Input::get('deliveryStreet');
$dHouseNr = Input::get('deliveryHouseNr');
$dPostCode = Input::get('deliveryPostCode');
$dTelephone = Input::get('deliveryTelephone');
DB::table('orders')->insert([
[
'customerName' => Input::get('usr'),
'customerLastname' => Input::get('lname'),
'customerEmail' => Input::get('email'),
'customerCity' => Input::get('city'),
'customerStreet' => Input::get('street'),
'customerHomeNumber' => Input::get('houseNr'),
'customerPostNumber' => Input::get('postCode'),
'customerPhoneNumber' => Input::get('telephone'),
'customerDeliveryCity' => Input::get('deliveryCity'),
'customerDeliveryStreet' => Input::get('deliveryStreet'),
'customerDeliveryHomeNumber' => Input::get('deliveryHouseNr'),
'customerDeliveryPostNumber' => Input::get('deliveryPostCode'),
'customerDeliveryPhoneNumber' => Input::get('deliveryTelephone'),
'choosenNotebook' => $laptops->name,
'choosenGpu' => $laptops->gpu,
'choosenCpu' => $laptops->cpu,
'choosenRam' => $laptops->ram,
'choosenHdd' => $laptops->hdd,
'choosenSsd' => $laptops->ssd,
'choosenAHdd' => $laptops->hdd2,
'choosenASsd' => $laptops->ssd2,
'choosenOs' => $laptops->os,
'choosenWarranty' => $laptops->warrantyOption,
'orderPrice' => $laptops->price,
]]);
Mail::send('shop.message', ['name' => Input::get('usr'), 'lastname' => Input::get('lname')], function($message)
{
$message->to(Input::get('email'), Input::get('usr'))->from('support@dreammachines.pl')->subject('Informacje dotyczące sprzędaży.');
}
);
return view('shop.payment', compact('laptops', 'name', 'lname', 'email', 'city', 'street', 'houseNr', 'postCode', 'telephone', 'dCity', 'dStreet', 'dHouseNr', 'dPostCode', 'dTelephone'));
}
That's how my controller looks like right know, it basically gets the data from an input and fetch some other information from the database, then it is supposed to save that data in other table, (that'll be used to track some information for an app). After that it should send a message, but even thou my .env file is set up correctly I'm not recieving any emails. Rest of the code works as I wanted it to.
Any idea what might make this script not working?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NnJ4sq
via IFTTT
Aucun commentaire:
Enregistrer un commentaire