Poprawki (nigdyn ie nazywaj tak commita)

This commit is contained in:
barwie2@st.amu.edu.pl 2019-12-03 12:45:04 +01:00
parent 2bc37a7a32
commit 85c8c21ff4
8 changed files with 9 additions and 13 deletions

View File

@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@ -23,6 +24,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
}

View File

@ -14,7 +14,7 @@ class CreateUsersTable extends Migration
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigIncrements('id')->unique();
$table->string('name');
$table->string('surname');
$table->string('email')->unique();

View File

@ -14,12 +14,10 @@ class CreateClassesTable extends Migration
public function up()
{
Schema::create('classes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigIncrements('id')->unique();
$table->integer('subject_id');
$table->date('date');
$table->timestamps();
$table->foreign('subject_id')->references('id')->on('subjects')->onDelete('cascade');
});
}

View File

@ -14,7 +14,7 @@ class CreateSubjectsTable extends Migration
public function up()
{
Schema::create('subjects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigIncrements('id')->unique();
$table->string('name');
$table->string('type')->nullable();
$table->string('weekday')->nullable();
@ -22,8 +22,6 @@ class CreateSubjectsTable extends Migration
$table->integer('room_id');
$table->integer('user_id');
$table->timestamps();
$table->foreign('room_id')->references('id')->on('rooms')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}

View File

@ -14,7 +14,7 @@ class CreateRoomsTable extends Migration
public function up()
{
Schema::create('rooms', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigIncrements('id')->unique();
$table->string('name')->unique();
$table->integer('capacity')->nullable();
$table->string('arrangement')->nullable();

View File

@ -14,14 +14,13 @@ class CreateAttendancesTable extends Migration
public function up()
{
Schema::create('attendances', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigIncrements('id')->unique();
$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')->onDelete('cascade');
});
}

View File

@ -60,7 +60,7 @@ class RoomsTableSeeder extends Seeder
array('name' => 'D-1', 'capacity' => 22),
array('name' => 'D-2', 'capacity' => 21),
array('name' => 'D-3', 'capacity' => 22),
array('name' => 'Klub Profesorski', 'capacity' => '')
array('name' => 'Klub Profesorski', 'capacity' => null)
];
foreach ($rooms as $room) {
DB::table('rooms')->insert([

View File

@ -49,7 +49,7 @@ Route::group(array('prefix' => 'admin', 'namespace' => 'Admin'), function()
});
});
Route::group(array('prefix' => 'user/{user_id}', 'namespace' => 'User'), function() {
Route::group(array('prefix' => 'user/{user_id}', 'namespace' => 'User'), function() { //TODO poprawic {user_id}
Route::get('/subjects/{groupBy}', 'UserSubjectsController@index')->name('user_subjects');
Route::get('/classes/{groupBy}', 'UserClassesController@index')->name('user_classes');
Route::get('/attendance/{groupBy}', 'UserAttendancesController@index')->name('user_attendances');