mirror of
https://github.com/ConjureETS/Interface-Admin.git
synced 2026-03-24 04:21:06 +00:00
Update User login info + Continue inscription foundation
This commit is contained in:
parent
fa19b6b258
commit
4c8e4aac3e
@ -9,14 +9,12 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\InscriptionMail;
|
||||
use App\Models\LaboratoryType;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class MailController extends Controller
|
||||
{
|
||||
public function sendInscriptionMail($member)
|
||||
{
|
||||
$laboratories = LaboratoryType::inscription()->get();
|
||||
Mail::to($member->email)->send(new InscriptionMail($member, $laboratories));
|
||||
Mail::to($member->email)->send(new InscriptionMail($member));
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ class InscriptionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $member;
|
||||
private $member;
|
||||
|
||||
public function __construct($member)
|
||||
{
|
||||
|
||||
@ -54,6 +54,10 @@ class Member extends Model
|
||||
return $this->hasOne('App\Models\CommunicationMethod', "preferred_communication_method_id", 'id');
|
||||
}
|
||||
|
||||
public function user() {
|
||||
return $this->hasOne('App\Models\User');
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------- Static */
|
||||
public static function getSemesterLetter()
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
@ -25,6 +26,8 @@ class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
Auth::provider('user_provider', function ($app, array $config) {
|
||||
return new UserProvider($app['hash'], $config['model']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
47
app/Providers/UserProvider.php
Normal file
47
app/Providers/UserProvider.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Massimo
|
||||
* Date: 2019-10-14
|
||||
* Time: 5:24 PM
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\EloquentUserProvider;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserProvider extends EloquentUserProvider
|
||||
{
|
||||
private $email_model = 'member';
|
||||
|
||||
public function retrieveByCredentials(array $credentials)
|
||||
{
|
||||
if (empty($credentials) ||
|
||||
(count($credentials) === 1 &&
|
||||
array_key_exists('password', $credentials))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query = $this->newModelQuery();
|
||||
|
||||
foreach ($credentials as $key => $value) {
|
||||
if (Str::contains($key, 'password')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_array($value) || $value instanceof Arrayable) {
|
||||
$query->with([$this->email_model => function ($q) use ($key, $value) {
|
||||
$q->whereIn($key, $value);
|
||||
}]);
|
||||
} else {
|
||||
$query->with([$this->email_model => function ($q) use ($key, $value) {
|
||||
$q->where($key, $value);
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->first();
|
||||
}
|
||||
}
|
||||
22
app/User.php
22
app/User.php
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
@ -37,8 +36,27 @@ class User extends Authenticatable
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'email', 'first_name', 'last_name'
|
||||
];
|
||||
|
||||
public function member()
|
||||
{
|
||||
return $this->hasOne("App\Models\Member");
|
||||
return $this->belongsTo("App\Models\Member");
|
||||
}
|
||||
|
||||
public function getEmailAttribute()
|
||||
{
|
||||
return $this->member->email;
|
||||
}
|
||||
|
||||
public function getFirstNameAttribute()
|
||||
{
|
||||
return $this->member->first_name;
|
||||
}
|
||||
|
||||
public function getLastNameAttribute()
|
||||
{
|
||||
return $this->member->last_name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ return [
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'driver' => 'user_provider',
|
||||
'model' => App\User::class,
|
||||
],
|
||||
|
||||
|
||||
BIN
public/img/logo-conjure.png
Normal file
BIN
public/img/logo-conjure.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
13
resources/lang/en/mails.php
Normal file
13
resources/lang/en/mails.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Massimo
|
||||
* Date: 2019-10-14
|
||||
* Time: 6:45 PM
|
||||
*/
|
||||
return [
|
||||
'laboratory' => "Laboratory",
|
||||
'laboratory-instruction' => "Choose one of the following laboratories.",
|
||||
'general.laboratory-return-instruction' => "To return the finished laboratory, send us a link towards your project to the following email: <a href=\"mailto:conjure.etsmtl.ca\">conjure.etsmtl.ca</a>.",
|
||||
'general.laboratory-deadline' => "You have up to the following date :deadline to return your finished admission laboratory.",
|
||||
];
|
||||
13
resources/lang/fr/mails.php
Normal file
13
resources/lang/fr/mails.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Massimo
|
||||
* Date: 2019-10-14
|
||||
* Time: 6:45 PM
|
||||
*/
|
||||
return [
|
||||
'laboratory' => "Laboratoire",
|
||||
'laboratory-instruction' => "Choisissez un des laboratoire suivant.",
|
||||
'laboratory-return-instruction' => "Pour remettre le laboratoire, envoit nous un lien vers ton projet au courriel suivant: <a href=\"mailto:conjure.etsmtl.ca\">conjure.etsmtl.ca</a>.",
|
||||
'laboratory-deadline' => "Vous avez jusqu'au :deadline pour remettre le laboratoire d'admission.",
|
||||
];
|
||||
@ -21,10 +21,15 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
|
||||
<header class="py-4">
|
||||
<img src="{{ public_path('img/logo-conjure.png') }}" alt="Logo Conjure" />
|
||||
</header>
|
||||
<main class="py-4">
|
||||
@yield('content')
|
||||
</main>
|
||||
<footer class="py-4">
|
||||
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,19 +1,25 @@
|
||||
@extends('layouts.app')
|
||||
@extends('layouts.app-email')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 justify-content-center">
|
||||
<h3></h3>
|
||||
<p></p>
|
||||
@foreach($laboratories as $laboratory)
|
||||
<a href="{{ $laboratory->url }}">{{ $laboratory->name." - ".$laboratory->engine }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<h3>{{ __('mails.laboratory') }}</h3>
|
||||
<p>{{ __('mails.laboratory-instruction') }}</p>
|
||||
<ul>
|
||||
@foreach($laboratories as $laboratory)
|
||||
<li><a href="{{ $laboratory->url }}">{{ $laboratory->name." - ".$laboratory->engine }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<p>{{ __('mails.laboratory-deadline', ['deadline' => date("d-m-Y", strtotime("+3 weeks"))]) }}</p>
|
||||
<p>{{ __('mails.laboratory-return-instruction') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@ -11,9 +11,13 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', 'InscriptionController@getInscription')->name('inscription');
|
||||
Route::post('/', 'InscriptionController@postInscription')->name('inscriptionSubmit');
|
||||
Route::group(['middleware' => ['guest']], function () {
|
||||
Route::get('/', 'InscriptionController@getInscription')->name('inscription');
|
||||
Route::post('/', 'InscriptionController@postInscription')->name('inscriptionSubmit');
|
||||
});
|
||||
|
||||
Auth::routes();
|
||||
|
||||
Route::get('/home', 'HomeController@index')->name('home');
|
||||
Route::group(['middleware' => ['auth']], function () {
|
||||
Route::get('/home', 'HomeController@index')->name('home');
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user