models added, registration form updated

This commit is contained in:
asia111307 2019-11-27 00:46:00 +01:00
parent f6a85cbba7
commit fc6faa7805
12 changed files with 209 additions and 1 deletions

12
app/Attendance.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Attendance extends Model
{
protected $fillable = [
'classes_id', 'student_id_number', 'student_name', 'student_surname', 'seat_number'
];
}

12
app/Class.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Class extends Model
{
protected $fillable = [
'subject_id', 'date'
];
}

View File

@ -50,6 +50,7 @@ class RegisterController extends Controller
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'surname' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
@ -65,6 +66,7 @@ class RegisterController extends Controller
{
return User::create([
'name' => $data['name'],
'surname' => $data['surname'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);

12
app/Room.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Room extends Model
{
protected $fillable = [
'name', 'capacity', 'type', 'arrangement'
];
}

12
app/Subject.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Subject extends Model
{
protected $fillable = [
'name', 'type', 'room_id', 'user_id'
];
}

View File

@ -16,7 +16,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name', 'surname', 'email', 'password',
];
/**

View File

@ -16,6 +16,7 @@ class CreateUsersTable extends Migration
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('surname');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateClassesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('classes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('subject_id');
$table->date('date');
$table->timestamps();
$table->foreign('subject_id')->references('id')->on('subjects');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('classes');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSubjectsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subjects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('type')->nullable();
$table->integer('room_id');
$table->integer('user_id');
$table->timestamps();
$table->foreign('room_id')->references('id')->on('rooms');
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subjects');
}
}

View File

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

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAttendancesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attendance', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('classes_id');
$table->integer('student_id_number');
$table->string('student_name');
$table->string('student_surname');
$table->integer('seat_number');
$table->timestamps();
$table->foreign('classes_id')->references('id')->on('classes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attendances');
}
}

View File

@ -25,6 +25,20 @@
</div>
</div>
<div class="form-group row">
<label for="surname" class="col-md-4 col-form-label text-md-right">{{ __('Surame') }}</label>
<div class="col-md-6">
<input id="surname" type="text" class="form-control @error('surname') is-invalid @enderror" name="surname" value="{{ old('surname') }}" required autocomplete="surname" 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>