login as lecturer

This commit is contained in:
Benjamin Takats
2022-12-01 11:23:15 +01:00
parent 9ec6b24a69
commit ba07dca294
20 changed files with 72 additions and 41 deletions

View File

@@ -8,16 +8,16 @@ created:
- database/factories/VenueFactory.php
- database/factories/EventFactory.php
- database/factories/RegistrationFactory.php
- database/migrations/2022_11_30_170514_create_countries_table.php
- database/migrations/2022_11_30_170515_create_cities_table.php
- database/migrations/2022_11_30_170516_create_lecturers_table.php
- database/migrations/2022_11_30_170517_create_participants_table.php
- database/migrations/2022_11_30_170518_create_categories_table.php
- database/migrations/2022_11_30_170519_create_courses_table.php
- database/migrations/2022_11_30_170520_create_venues_table.php
- database/migrations/2022_11_30_170521_create_events_table.php
- database/migrations/2022_11_30_170522_create_registrations_table.php
- database/migrations/2022_11_30_170523_create_category_course_table.php
- database/migrations/2022_12_01_100450_create_countries_table.php
- database/migrations/2022_12_01_100451_create_cities_table.php
- database/migrations/2022_12_01_100452_create_lecturers_table.php
- database/migrations/2022_12_01_100453_create_participants_table.php
- database/migrations/2022_12_01_100454_create_categories_table.php
- database/migrations/2022_12_01_100455_create_courses_table.php
- database/migrations/2022_12_01_100456_create_venues_table.php
- database/migrations/2022_12_01_100457_create_events_table.php
- database/migrations/2022_12_01_100458_create_registrations_table.php
- database/migrations/2022_12_01_100459_create_category_course_table.php
- app/Models/Country.php
- app/Models/City.php
- app/Models/Lecturer.php

View File

@@ -28,6 +28,7 @@ class CreateNewUser implements CreatesNewUsers
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => app()->environment('local') ? 'required' : $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
'is_lecturer' => ['required'],
])
->validate();
@@ -36,6 +37,7 @@ class CreateNewUser implements CreatesNewUsers
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
'is_lecturer' => $input['is_lecturer'] === 'on',
]), function (User $user) {
$this->createTeam($user);
});

View File

@@ -25,7 +25,10 @@ class User extends Authenticatable implements MustVerifyEmail
* @var string[]
*/
protected $fillable = [
'name', 'email', 'password',
'name',
'email',
'password',
'is_lecturer',
];
/**

View File

@@ -11,6 +11,7 @@ class Venue extends Model
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
@@ -22,6 +23,7 @@ class Venue extends Model
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [

View File

@@ -4,11 +4,9 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
@@ -16,19 +14,24 @@ return new class extends Migration
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('email')
->unique();
$table->timestamp('email_verified_at')
->nullable();
$table->string('password');
$table->rememberToken();
$table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path', 2048)->nullable();
$table->foreignId('current_team_id')
->nullable();
$table->string('profile_photo_path', 2048)
->nullable();
$table->boolean('is_lecturer')
->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()

View File

@@ -37,11 +37,13 @@ class DatabaseSeeder extends Seeder
'password' => bcrypt('1234'),
'remember_token' => Str::random(10),
]);
Team::create([
$team = Team::create([
'name' => 'Admin Team',
'user_id' => $user->id,
'personal_team' => true,
]);
$user->current_team_id = $team->id;
$user->save();
Country::create([
'name' => 'Deutschland',
'code' => 'de',

View File

@@ -1,4 +1,5 @@
{
"I want to submit new courses on this platform": "Ich bin Dozent und möchte neue Kurse auf dieser Plattform einstellen",
"(and :count more error)": "(und :count weiterer Fehler)",
"(and :count more errors)": "(und :count weitere Fehler)",
"A fresh verification link has been sent to your email address.": "Ein neuer Bestätigungslink wurde an Ihre E-Mail-Adresse gesendet.",

View File

@@ -37,6 +37,7 @@
</div>
<div class="flex items-center justify-end mt-4">
@if (Route::has('password.request'))
<a class="underline text-sm text-gray-600 hover:text-gray-900"
href="{{ route('password.request') }}">
@@ -47,6 +48,7 @@
<x-jet-button class="ml-4">
{{ __('Log in') }}
</x-jet-button>
</div>
</form>
</x-jet-authentication-card>

View File

@@ -1,39 +1,55 @@
<x-guest-layout>
<x-jet-authentication-card>
<x-slot name="logo">
<x-jet-authentication-card-logo />
<x-jet-authentication-card-logo/>
</x-slot>
<x-jet-validation-errors class="mb-4" />
<x-jet-validation-errors class="mb-4"/>
<form method="POST" action="{{ route('register') }}">
@csrf
<div>
<x-jet-label for="name" value="{{ __('Name') }}" />
<x-jet-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="name" />
<x-jet-label for="name" value="{{ __('Name') }}"/>
<x-jet-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required
autofocus autocomplete="name"/>
</div>
<div class="mt-4">
<x-jet-label for="email" value="{{ __('Email') }}" />
<x-jet-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required />
<x-jet-label for="email" value="{{ __('Email') }}"/>
<x-jet-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')"
required/>
</div>
<div class="mt-4">
<x-jet-label for="password" value="{{ __('Password') }}" />
<x-jet-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
<x-jet-label for="password" value="{{ __('Password') }}"/>
<x-jet-input id="password" class="block mt-1 w-full" type="password" name="password" required
autocomplete="new-password"/>
</div>
<div class="mt-4">
<x-jet-label for="password_confirmation" value="{{ __('Confirm Password') }}" />
<x-jet-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" required autocomplete="new-password" />
<x-jet-label for="password_confirmation" value="{{ __('Confirm Password') }}"/>
<x-jet-input id="password_confirmation" class="block mt-1 w-full" type="password"
name="password_confirmation" required autocomplete="new-password"/>
</div>
<div class="mt-4">
<x-jet-label for="is_lecturer">
<div class="flex items-center">
<x-jet-checkbox name="is_lecturer" id="is_lecturer" required/>
<div class="ml-2">
{{ __('I want to submit new courses on this platform') }}
</div>
</div>
</x-jet-label>
</div>
@if (Laravel\Jetstream\Jetstream::hasTermsAndPrivacyPolicyFeature())
<div class="mt-4">
<x-jet-label for="terms">
<div class="flex items-center">
<x-jet-checkbox name="terms" id="terms" required />
<x-jet-checkbox name="terms" id="terms" required/>
<div class="ml-2">
{!! __('I agree to the :terms_of_service and :privacy_policy', [

View File

@@ -3,7 +3,7 @@
{{ $logo }}
</div>
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
<div class="w-full sm:max-w-xl mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
{{ $slot }}
</div>
</div>