Start Building Foundation

This commit is contained in:
Massimo Di Lullo 2019-10-13 19:38:38 -04:00
parent 911102e0c2
commit fa19b6b258
45 changed files with 1049 additions and 448 deletions

View File

@ -25,7 +25,7 @@ class LoginController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = '/home'; protected $redirectTo = '/';
/** /**
* Create a new controller instance. * Create a new controller instance.

View File

@ -1,72 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers;
use App\Models\CommunicationMethod;
use App\Models\Interest;
use App\Models\Member;
use App\Models\Program;
use App\Rules\PhoneRule;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class InscriptionController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct(){ }
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function getInscription()
{
return view('inscription')->with([
"programs" => Program::all(),
"interests" => Interest::all(),
"communicationMethods" => CommunicationMethod::all()
]);
}
public function postInscription(Request $request)
{
$this->validator($request->all())->validate();
$member = $this->create($request->all());
return view('inscription')->with([
'member' => $member
]);
}
protected function validator(array $data)
{
return Validator::make($data, [
'first_name' => ['required', 'string', 'max:255'],
'last_name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:members'],
'universal_code' => ['required', 'string', 'max:255'],
'phone' => ['sometimes', new PhoneRule],
'program_id' => ['required', 'integer']
]);
}
protected function create(array $data)
{
return Member::create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'email' => $data['email'],
'universal_code' => $data['universal_code'],
'start_semester' => Member::getSemesterLetter().date("Y"),
'activity' => Member::ACTIVITY[0],
'phone' => $data['phone'],
'program_id' => $data['program_id']
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-10-12
* Time: 9:17 PM
*/
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));
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-10-12
* Time: 9:24 PM
*/
namespace App\Mail;
use App\Models\LaboratoryType;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class InscriptionMail extends Mailable
{
use Queueable, SerializesModels;
public $member;
public function __construct($member)
{
$this->member = $member;
}
public function build()
{
$laboratories = LaboratoryType::inscription()->get();
return $this->from('conjure@etsmtl.ca')
->view('mails.inscription')
->with(
[
"member" => $this->member,
"laboratories" => $laboratories
]);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CommunicationMethod extends Model
{
}

10
app/Models/Interest.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Interest extends Model
{
}

33
app/Models/Laboratory.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 3:07 PM
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Laboratory extends Model
{
public const STATUS = ["Envoyé", "Remis", "Corrigé", "À Refaire", "Accepté", "Refusé", "Deadline Dépassé"];
public function member()
{
return $this->belongsTo('App\Models\Member');
}
public function getStatusAttribute()
{
return self::STATUS[$this->status_id];
}
public function laboratoryType()
{
return $this->hasOne('App\Models\LaboratoryType');
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 3:07 PM
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class LaboratoryType extends Model
{
public const STATUS = ["Inactif", "Draft", "Actif"];
public const TYPE = ["Inscription", "Formation", "Défi Technique"];
public function getStatusAttribute()
{
return self::STATUS[$this->status_id];
}
public function getTypeAttribute()
{
return self::TYPE[$this->type_id];
}
public function laboratory()
{
return $this->belongsTo('App\Models\Laboratory');
}
public function scopeInscription($query)
{
return $query->where('status_id', array_search("Actif", self::STATUS))
->where('type_id', array_search("Inscription", self::TYPE));
}
}

74
app/Models/Member.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 3:12 PM
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Member extends Model
{
public const ACTIVITY = ['Actif', 'En Inscription', 'Inactif', 'Quitté', 'Gradué'];
protected $fillable = [
"first_name",
"last_name",
"email",
"universal_code",
"phone",
"start_semester",
"program_id",
"laboratory_id",
"activity",
"expectation",
"preferred_communication_method_id"
];
public function getActivityAttribute()
{
return self::ACTIVITY[$this->activity_id];
}
/* ------------------------------------------------------------------------------------------------ Relationships */
public function program()
{
return $this->hasOne('App\Models\Program');
}
public function laboratory()
{
return $this->hasOne('App\Models\Laboratory');
}
public function interests()
{
return $this->hasMany('App\Models\Interest');
}
public function communicationMethod()
{
return $this->hasOne('App\Models\CommunicationMethod', "preferred_communication_method_id", 'id');
}
/* ------------------------------------------------------------------------------------------------------- Static */
public static function getSemesterLetter()
{
$month = date('n');
if ($month >= 9) {
$semester = "A";
}
elseif ($month >= 5) {
$semester = "É";
}
else {
$semester = "H";
}
return $semester;
}
}

19
app/Models/Program.php Normal file
View File

@ -0,0 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 3:07 PM
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Program extends Model
{
public function member()
{
return $this->belongsTo('App\Models\Member');
}
}

42
app/Rules/PhoneRule.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class PhoneRule implements Rule
{
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if(!empty($value))
return preg_match('/^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$/i', $value) && strlen($value) >= 10;
return true;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return trans('validation.phone');
}
}

View File

@ -16,7 +16,7 @@ class User extends Authenticatable
* @var array * @var array
*/ */
protected $fillable = [ protected $fillable = [
'name', 'email', 'password', 'password',
]; ];
/** /**
@ -36,4 +36,9 @@ class User extends Authenticatable
protected $casts = [ protected $casts = [
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
]; ];
public function member()
{
return $this->hasOne("App\Models\Member");
}
} }

View File

@ -1,27 +0,0 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
});

View File

@ -15,9 +15,7 @@ class CreateUsersTable extends Migration
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->string('name'); $table->bigInteger('member_id');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProgramsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('programs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string("acronym", 50);
$table->string("name");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('programs');
}
}

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMembersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('members', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string("first_name");
$table->string("last_name");
$table->string("email")->unique();
$table->string("universal_code", 7);
$table->string("phone")->nullable();
$table->string("start_semester");
$table->string("last_semester")->nullable();
$table->integer("program_id");
$table->integer("laboratory_id")->nullable();
$table->integer("activity");
$table->text("expectation")->nullable();
$table->integer("preferred_communication_method_id")->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('members');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInterestsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('interests', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string("name");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('interests');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommnucationMethodsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('communication_methods', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('communication_methods');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLaboratoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('laboratories', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('status_id')->default(0);
$table->integer('laboratory_type_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('laboratories');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLaboratoryTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('laboratory_types', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('status_id')->default(0);
$table->string("name");
$table->integer("type_id");
$table->string("engine");
$table->string('url');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('laboratory_types');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class CommunicationMethodTableSeeder extends Seeder
{
private $data =[
"Discord", "Facebook", "E-Mail", "Autre"
];
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('communication_methods')->truncate();
foreach($this->data as $value) {
DB::table('communication_methods')->insert([
'name' => $value,
]);
}
}
}

View File

@ -11,6 +11,8 @@ class DatabaseSeeder extends Seeder
*/ */
public function run() public function run()
{ {
// $this->call(UsersTableSeeder::class); $this->call(CommunicationMethodTableSeeder::class);
$this->call(ProgramTableSeeder::class);
$this->call(DefaultUserTableSeeder::class);
} }
} }

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Seeder;
use \Illuminate\Support\Facades\DB;
class DefaultUserTableSeeder extends Seeder
{
private $members = [
["Conjure", "ETS", "conjure@etsmtl.ca", "000000", "A2019", 1, 0, 2],
];
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('members')->truncate();
DB::table('users')->truncate();
foreach($this->members as $key => $data) {
\App\Models\Member::create([
"first_name" => $data[0],
"last_name" => $data[1],
"email" => $data[2],
"universal_code" => $data[3],
"start_semester" => $data[4],
"program_id" => $data[5],
"activity" => $data[6],
"preferred_communication_method_id" => $data[7]
]);
\App\User::create([
"member_id" => $key + 1,
"password" => \Illuminate\Support\Facades\Hash::make(strtolower($data[0][0].$data[1])."-".$data[4]."&".\App\Models\Program::where("id", $data[5])->first()["acronym"])
]);
}
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
class ProgramTableSeeder extends Seeder
{
private $data = [
["LOG", "Génie logiciel"],
["TI", "Génie des technologies de l'information"],
["ELE", "Génie électrique"],
["GOL", "Génie des opérations et de la logistique"],
["GPA", "Génie de la production automatisée"],
["MEC", "Génie mécanique"],
["CTN", "Génie de la construction"],
["CUT", "Cheminement universitaire en technologie"],
["Maîtrise", "Maîtrise"],
["Doctorat", "Doctorat"]
];
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('programs')->truncate();
foreach($this->data as $value) {
DB::table('programs')->insert([
'acronym' => $value[0],
'name' => $value[1],
]);
}
}
}

View File

@ -0,0 +1,10 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 6:01 PM
*/
return [
'submit' => "Submit",
];

View File

@ -0,0 +1,31 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 6:01 PM
*/
return [
'login' => "Login",
'logout' => "Logout",
'password' => "Password",
'confirm-password' => "Confirm Password",
'forgot-password' => "Forgot Your Password?",
'remember-me' => "Remember Me",
'reset-password' => "Reset Password",
'send-password-reset-link' => "Send Password Reset Link",
'inscription' => "Inscription",
'general-info' => "General Information",
'first-name' => "First Name",
'last-name' => "Last Name",
'email' => "E-Mail",
'universal-code' => "Universal Code",
'phone' => "Phone",
'program' => "Program",
'others' => "Others",
'interest' => "Interest",
'expectation' => "Expectation",
'communication-method' => "Preferred Communication Method",
'choose-option' => "Choose an option"
];

View File

@ -116,7 +116,7 @@ return [
'uploaded' => 'The :attribute failed to upload.', 'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.', 'url' => 'The :attribute format is invalid.',
'uuid' => 'The :attribute must be a valid UUID.', 'uuid' => 'The :attribute must be a valid UUID.',
'phone' => 'The phone number format is invalid.',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Validation Language Lines | Custom Validation Language Lines

View File

@ -0,0 +1,10 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 6:02 PM
*/
return [
'submit' => "Envoyer",
];

View File

@ -0,0 +1,31 @@
<?php
/**
* Created by PhpStorm.
* User: Massimo
* Date: 2019-09-29
* Time: 6:02 PM
*/
return [
'login' => "Connexion",
'logout' => "Déconnexion",
'password' => "Mot de passe",
'confirm-password' => "Confirmation du mot de passe",
'forgot-password' => "Mot de passe oublié?",
'remember-me' => "Se rappeler de moi",
'reset-password' => "Réinitialiser le mot de passe",
'send-password-reset-link' => "Envoyer le lien de réinitialisation de mot de passe",
'inscription' => "Inscription",
'general-info' => "Information Générale",
'first-name' => "Prénom",
'last-name' => "Nom de famille",
'email' => "Courriel",
'universal-code' => "Code Universel",
'phone' => "Téléphone",
'program' => "Programme",
'others' => "Autres",
'interests' => "Intérêts",
'expectations' => "Attentes",
'communication-method' => "Méthode de communication préférée",
'choose-option' => "Choisissez une option"
];

View File

@ -116,6 +116,7 @@ return [
'uploaded' => ':attribute a échoué à téléverser.', 'uploaded' => ':attribute a échoué à téléverser.',
'url' => 'Le format de :attribute est invalide.', 'url' => 'Le format de :attribute est invalide.',
'uuid' => ':attribute doit être un UUID valide.', 'uuid' => ':attribute doit être un UUID valide.',
'phone' => 'Le format du numéro de téléphone est invalide.',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -5,14 +5,14 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-8">
<div class="card"> <div class="card">
<div class="card-header">{{ __('Login') }}</div> <div class="card-header">{{ __('general.login') }}</div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="{{ route('login') }}"> <form method="POST" action="{{ route('login') }}">
@csrf @csrf
<div class="form-group row"> <div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label> <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('general.email') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus> <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@ -26,7 +26,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label> <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('general.password') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password"> <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@ -45,7 +45,7 @@
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}> <input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember"> <label class="form-check-label" for="remember">
{{ __('Remember Me') }} {{ __('general.remember-me') }}
</label> </label>
</div> </div>
</div> </div>
@ -54,12 +54,12 @@
<div class="form-group row mb-0"> <div class="form-group row mb-0">
<div class="col-md-8 offset-md-4"> <div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{{ __('Login') }} {{ __('general.login') }}
</button> </button>
@if (Route::has('password.request')) @if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}"> <a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }} {{ __('general.forgot-password') }}
</a> </a>
@endif @endif
</div> </div>

View File

@ -5,7 +5,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-8">
<div class="card"> <div class="card">
<div class="card-header">{{ __('Reset Password') }}</div> <div class="card-header">{{ __('general.reset-password') }}</div>
<div class="card-body"> <div class="card-body">
@if (session('status')) @if (session('status'))
@ -18,7 +18,7 @@
@csrf @csrf
<div class="form-group row"> <div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label> <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('general.email') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus> <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@ -34,7 +34,7 @@
<div class="form-group row mb-0"> <div class="form-group row mb-0">
<div class="col-md-6 offset-md-4"> <div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }} {{ __('general.send-password-reset-link') }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -5,7 +5,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-8">
<div class="card"> <div class="card">
<div class="card-header">{{ __('Reset Password') }}</div> <div class="card-header">{{ __('general.reset-password') }}</div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="{{ route('password.update') }}"> <form method="POST" action="{{ route('password.update') }}">
@ -14,7 +14,7 @@
<input type="hidden" name="token" value="{{ $token }}"> <input type="hidden" name="token" value="{{ $token }}">
<div class="form-group row"> <div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label> <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('general.email') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus> <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@ -28,7 +28,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label> <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('general.password') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password"> <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@ -42,7 +42,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label> <label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('general.confirm-password') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password"> <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
@ -52,7 +52,7 @@
<div class="form-group row mb-0"> <div class="form-group row mb-0">
<div class="col-md-6 offset-md-4"> <div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{{ __('Reset Password') }} {{ __('general.reset-password') }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -1,77 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -1,28 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
<div class="card-body">
@if (session('resent'))
<div class="alert alert-success" role="alert">
{{ __('A fresh verification link has been sent to your email address.') }}
</div>
@endif
{{ __('Before proceeding, please check your email for a verification link.') }}
{{ __('If you did not receive the email') }},
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,171 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('general.inscription') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('inscription') }}">
@csrf
<div class="form-group row">
<h4 class="col-md-12 card-subtitle">{{ __('general.general-info') }}</h4>
</div>
<div class="form-group row">
<label for="first_name" class="col-md-4 col-form-label text-md-right">{{ __('general.first-name') }}</label>
<div class="col-md-8">
<input id="first_name" type="text" class="form-control @error('first_name') is-invalid @enderror" name="first_name" value="{{ old('first_name') }}" required autocomplete="first_name" autofocus>
@error('first_name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="last_name" class="col-md-4 col-form-label text-md-right">{{ __('general.last-name') }}</label>
<div class="col-md-8">
<input id="last_name" type="text" class="form-control @error('last_name') is-invalid @enderror" name="last_name" value="{{ old('last_name') }}" required autocomplete="last_name" autofocus>
@error('last_name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('general.email') }}</label>
<div class="col-md-8">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="universal_code" class="col-md-4 col-form-label text-md-right">{{ __('general.universal-code') }}</label>
<div class="col-md-8">
<input id="universal_code" type="text" class="form-control @error('universal_code') is-invalid @enderror" name="universal_code" value="{{ old('universal_code') }}" required autocomplete="universal_code">
@error('universal_code')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="phone" class="col-md-4 col-form-label text-md-right">{{ __('general.phone') }}</label>
<div class="col-md-8">
<input id="phone" type="tel" class="form-control @error('phone') is-invalid @enderror" name="phone" value="{{ old('phone') }}" autocomplete="phone">
@error('phone')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="program" class="col-md-4 col-form-label text-md-right">{{ __('general.program') }}</label>
<div class="col-md-8">
<select id="program" class="form-control @error('program') is-invalid @enderror" name="program" value="{{ old('program') }}" required autocomplete="program">
<option>{{ __('general.choose-option') }}</option>
@foreach($programs as $program)
<option value="{{ $program->id }}">{{ $program->name }}</option>
@endforeach
</select>
@error('program')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="communication_method" class="col-md-4 col-form-label text-md-right">{{ __('general.communication-method') }}</label>
<div class="col-md-8">
<select id="communication_method" class="form-control @error('communication_method') is-invalid @enderror" name="communication_method" value="{{ old('communication_method') }}" required autocomplete="communication_method">
<option>{{ __('general.choose-option') }}</option>
@foreach($communicationMethods as $communicationMethod)
<option value="{{ $communicationMethod->id }}">{{ $communicationMethod->name }}</option>
@endforeach
</select>
@error('communication_method')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<h3 class="col-md-12 card-subtitle">{{ __('general.others') }}</h3>
</div>
@if(!$interests->isEmpty())
<div class="form-group row">
<label class="col-md-4 col-form-label text-md-right">{{ __('general.interests') }}</label>
<div class="col-md-8">
@foreach($interests as $interest)
<label for="interest-{{ $interest->id }}" class="col-form-label text-md-right">{{ $interest->name }}</label>
<input type="checkbox" class="form-control" name="interest" id="interest-{{ $interest->id }}" value="{{ $interest->id }}" autocomplete="interest">
@endforeach
</div>
</div>
@endif
<div class="form-group row">
<label for="expectation" class="col-md-4 col-form-label text-md-right">{{ __('general.expectations') }}</label>
<div class="col-md-8">
<textarea id="expectation" class="form-control @error('expectation') is-invalid @enderror" name="expectation" value="{{ old('expectation') }}" autocomplete="expectation"></textarea>
@error('expectation')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('button.submit') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,30 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }} - @yield('title')</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
<main class="py-4">
@yield('content')
</main>
</div>
</body>
</html>

View File

@ -7,7 +7,7 @@
<!-- CSRF Token --> <!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title> <title>{{ config('app.name', 'Laravel') }} - @yield('title')</title>
<!-- Scripts --> <!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script> <script src="{{ asset('js/app.js') }}" defer></script>
@ -21,56 +21,7 @@
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm"> @include('layouts.partials.navigation')
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav mr-auto">
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Authentication Links -->
@guest
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
</li>
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
</div>
</li>
@endguest
</ul>
</div>
</div>
</nav>
<main class="py-4"> <main class="py-4">
@yield('content') @yield('content')

View File

@ -0,0 +1,46 @@
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav mr-auto">
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Authentication Links -->
@guest
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('general.login') }}</a>
</li>
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('general.logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
</div>
</li>
@endguest
</ul>
</div>
</div>
</nav>

View File

@ -0,0 +1,19 @@
@extends('layouts.app')
@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">
<p></p>
@foreach($laboratories as $laboratory)
<a href="{{ $laboratory->url }}">{{ $laboratory->name." - ".$laboratory->engine }}</a>
@endforeach
</div>
</div>
</div>
</div>
@endsection

View File

@ -1,100 +0,0 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Nunito', sans-serif;
font-weight: 200;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 13px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
@if (Route::has('register'))
<a href="{{ route('register') }}">Register</a>
@endif
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Docs</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://blog.laravel.com">Blog</a>
<a href="https://nova.laravel.com">Nova</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://vapor.laravel.com">Vapor</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -11,9 +11,8 @@
| |
*/ */
Route::get('/', function () { Route::get('/', 'InscriptionController@getInscription')->name('inscription');
return view('welcome'); Route::post('/', 'InscriptionController@postInscription')->name('inscriptionSubmit');
});
Auth::routes(); Auth::routes();