Commit a73f5bdd authored by ZeMKI's avatar ZeMKI
Browse files

Create user command now send an email

- testing the send email interface on laravel.
parent 17e6e2a1
......@@ -52,15 +52,19 @@ class CreateUserCommand extends Command
$this->info('3 -> Researcher');
$role = $this->choice('User role?', [2, 3]);
if ($this->store($role, $email, $password))
if ($this->store($role, $email, $password, $user))
{
Mail::to($email)->send(new VerificationEmail($user));
return true;
}
else
return false;
}
public function store($roleId, $email, $password)
public function store($roleId, $email, $password, &$user)
{
$role = Role::where('id', $roleId)->first();
......
......@@ -2,11 +2,10 @@
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use \App\User;
class VerificationEmail extends Mailable
{
......@@ -29,6 +28,6 @@ class VerificationEmail extends Mailable
*/
public function build()
{
return $this->from('example@example.com')->markdown('email.setpassword')->with(['user'=>$this->user]);
return $this->from('noreply@kommunikative-figurationen.de')->markdown('email.setpassword')->with(['user' => $this->user]);
}
}
@extends('admin.layout')
@extends('admin.layout')
@section('content')
@section('content')
<div class="columns">
@if(isset($message))
<div class="columns">
@if(isset($message))
<span @created="showtoast({{$message}})"></span>
<span @created="showtoast({{$message}})"></span>
@endif
@endif
<div class="level">
<div class="column">
<h1 class="title">Create a Supervisor</h1>
<p class="subtitle"> some text to explain what a supervisor is and can do</p>
<form method="POST" action="{{url('admin/users/supervisor')}}" class="" style="padding-top: 40px">
@csrf
<input type="hidden" value="2" name="role">
<div class="field">
<label for="name" class="label">
Email
</label>
<div class="control">
<input type="text" class="input" name="email">
</div>
</div>
<div class="level">
<div class="column">
<h1 class="title">Create a Supervisor</h1>
<p class="subtitle"> some text to explain what a supervisor is and can do</p>
<form method="POST" action="{{url('admin/users/supervisor')}}" class="" style="padding-top: 40px">
@csrf
<input type="hidden" value="2" name="role">
<div class="field">
<label for="name" class="label">
Email
</label>
<div class="control">
<input type="text" class="input" name="email">
</div>
</div>
<div class="field">
<label for="email" class="label">
Email text
</label>
<div class="field">
<label for="email" class="label">
Email text
</label>
<textarea class="textarea" name="email" placeholder="e.g. Hello world"></textarea>
<textarea class="textarea" name="email" placeholder="e.g. Hello world"></textarea>
</div>
</div>
<div class="level">
<div class="field">
<div class="control">
<button class="button is-link">Send email</button>
</div>
</div>
<div class="level">
<div class="field">
<div class="control">
<button class="button is-link">Send email</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment