Hi guys i need help with send code on email [laravel]
i recieve an email but without link and username like that
Hello username
Please activate your account using the following link
link
Here is my code
activate.blade.php
Hello {{ 'username' }}
Please activate your account using the following link
---
{{ 'link' }}
AccountController
<?php
class AccountController extends BaseController {
public function getCreate() {
return View::make('account.create');
}
public function postCreate() {
$validator = Validator::make(Input::all(),
array(
'email' => 'required|max:50|email|unique:users',
'username' => 'required|max:20|min:3|unique:users',
'password' => 'required|min:6',
'password_again' => 'required|same:password'
)
);
if($validator->fails()) {
return Redirect::route('account-create')
->withErrors($validator)
->withInput();
} else {
$email = Input::get('email');
$username = Input::get('username');
$password = Input::get('password');
//Activation code
$code = str_random(60);
$user = User::create(array(
'email' => $email,
'username' => $username,
'password' => Hash::make($password),
'code' => $code,
'active' => 0
));
if($user) {
Mail::send('emails.auth.activate', array('link' => URL::route('account-activate', $code), 'username' => $username), function($message) use ($user) {
$message->to($user->email, $user->username)->subject('Activate your account');
});
return Redirect::route('home')
->with('global', 'Your account has been created! We have sent you an email to activate your account.');
}
}
}
public function getActivate($code) {
}
}
Home controller
<?php
class HomeController extends BaseController { public function home() {
Mail::send('emails.auth.activate', array('name' => 'NoReply'), function($message){
$message->to('noreply@bla.com', 'Noreply')->subject('Noreplymail');
});
return View::make('home');
}
}
Thanks in advance.