Initial commit

This commit is contained in:
Richard Jolley committed 2026-01-14 00:54:08 +00:00
commit c909d539bc
7178 files changed
+756624

No files matched your search

+1
View File
@@ -0,0 +1 @@
*.sqlite*
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('billing_accounts', function (Blueprint $table) {
$table->id();
// Basic billing account identity
$table->string('name'); // e.g. "Smith Family" or "Acme Ltd"
$table->string('contact_name')->nullable(); // attachment for companies
// Primary parent user (nullable)
$table->unsignedBigInteger('primary_parent_user_id')->nullable();
$table->foreign('primary_parent_user_id')
->references('id')->on('users')
->nullOnDelete();
// Core billing communication channel
$table->string('invoice_email');
// Optional phone for billing queries
$table->string('phone')->nullable();
// Address fields
$table->string('address_line1');
$table->string('address_line2')->nullable();
$table->string('town');
$table->string('postcode');
$table->string('country');
$table->softDeletes();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('billing_accounts');
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('student_profiles', function (Blueprint $table) {
$table->unsignedBigInteger('billing_account_id')->nullable()->after('user_id');
$table->foreign('billing_account_id')
->references('id')->on('billing_accounts')
->nullOnDelete();
});
}
public function down(): void
{
Schema::table('student_profiles', function (Blueprint $table) {
$table->dropForeign(['billing_account_id']);
$table->dropColumn('billing_account_id');
});
}
};
@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('parent_profiles', function (Blueprint $table) {
$table->id();
// Link to the users table
$table->unsignedBigInteger('user_id')->unique();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
// Parent contact info
$table->string('phone')->nullable();
// Parent address (optional, but useful)
$table->string('address_line1')->nullable();
$table->string('address_line2')->nullable();
$table->string('town')->nullable();
$table->string('postcode')->nullable();
$table->string('country')->nullable();
// Notes about the parent
$table->text('notes')->nullable();
$table->softDeletes();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('parent_profiles');
}
};
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('parent_student', function (Blueprint $table) {
$table->id();
// Foreign keys
$table->unsignedBigInteger('parent_profile_id');
$table->unsignedBigInteger('student_profile_id');
$table->foreign('parent_profile_id')
->references('id')->on('parent_profiles')
->onDelete('cascade');
$table->foreign('student_profile_id')
->references('id')->on('student_profiles')
->onDelete('cascade');
// Optional descriptive relationship
$table->string('relationship')->nullable();
// Optional admin notes
$table->text('notes')->nullable();
$table->timestamps();
// Ensure a parent cannot be linked to the same student twice
$table->unique(['parent_profile_id', 'student_profile_id']);
});
}
public function down(): void
{
Schema::dropIfExists('parent_student');
}
};
@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
// Add new columns
$table->string('first_name')->nullable()->after('id');
$table->string('last_name')->nullable()->after('first_name');
// Make 'name' nullable so inserts won't fail
$table->string('name')->nullable()->change();
});
// Backfill: split existing 'name' into first and last
$users = DB::table('users')->select('id', 'name')->get();
foreach ($users as $user) {
if (!$user->name) {
continue;
}
// Split the name safely
$parts = explode(' ', $user->name, 2);
$first = $parts[0];
$last = $parts[1] ?? '';
DB::table('users')
->where('id', $user->id)
->update([
'first_name' => $first,
'last_name' => $last,
]);
}
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['first_name', 'last_name']);
// restore name to not null if needed
$table->string('name')->nullable(false)->change();
});
}
};
+809
View File
@@ -0,0 +1,809 @@
/*M!999999\- enable the sandbox mode */
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `bookings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `bookings` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`slot_id` bigint(20) unsigned NOT NULL,
`date` date NOT NULL,
`student_name` varchar(255) DEFAULT NULL,
`booked_from_page` varchar(255) DEFAULT NULL,
`message` text DEFAULT NULL,
`status` enum('booked','blocked') NOT NULL DEFAULT 'booked',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `bookings_slot_id_date_unique` (`slot_id`,`date`),
CONSTRAINT `bookings_slot_id_foreign` FOREIGN KEY (`slot_id`) REFERENCES `slots` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache` (
`key` varchar(255) NOT NULL,
`value` mediumtext NOT NULL,
`expiration` int(11) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `cache_locks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache_locks` (
`key` varchar(255) NOT NULL,
`owner` varchar(255) NOT NULL,
`expiration` int(11) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `chapters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `chapters` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`lesson_section_id` bigint(20) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`slug` varchar(255) DEFAULT NULL,
`order` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `chapters_slug_unique` (`slug`),
KEY `chapters_lesson_section_id_foreign` (`lesson_section_id`),
CONSTRAINT `chapters_lesson_section_id_foreign` FOREIGN KEY (`lesson_section_id`) REFERENCES `lesson_sections` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `course_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_user` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`course_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`last_lesson_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `course_user_user_id_foreign` (`user_id`),
KEY `course_user_course_id_foreign` (`course_id`),
KEY `course_user_last_lesson_id_foreign` (`last_lesson_id`),
CONSTRAINT `course_user_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
CONSTRAINT `course_user_last_lesson_id_foreign` FOREIGN KEY (`last_lesson_id`) REFERENCES `lessons` (`id`) ON DELETE SET NULL,
CONSTRAINT `course_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `courses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `courses` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`lead_teacher` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`subject_id` bigint(20) unsigned NOT NULL,
`level_id` bigint(20) unsigned NOT NULL,
`slug` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `courses_subject_id_foreign` (`subject_id`),
KEY `courses_level_id_foreign` (`level_id`),
CONSTRAINT `courses_level_id_foreign` FOREIGN KEY (`level_id`) REFERENCES `levels` (`id`) ON DELETE CASCADE,
CONSTRAINT `courses_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `external_busy_windows`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `external_busy_windows` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`external_calendar_id` bigint(20) unsigned NOT NULL,
`starts_at` datetime NOT NULL,
`ends_at` datetime NOT NULL,
`transparency` varchar(255) NOT NULL DEFAULT 'OPAQUE',
`last_seen_at` datetime DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `external_busy_windows_external_calendar_id_starts_at_index` (`external_calendar_id`,`starts_at`),
CONSTRAINT `external_busy_windows_external_calendar_id_foreign` FOREIGN KEY (`external_calendar_id`) REFERENCES `external_calendars` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `external_calendars`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `external_calendars` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`source` varchar(255) NOT NULL DEFAULT 'nextcloud-ics',
`url` text NOT NULL,
`is_enabled` tinyint(1) NOT NULL DEFAULT 1,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) NOT NULL,
`connection` text NOT NULL,
`queue` text NOT NULL,
`payload` longtext NOT NULL,
`exception` longtext NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `features`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `features` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`scope` varchar(255) NOT NULL,
`value` text NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `features_name_scope_unique` (`name`,`scope`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `invoice_items`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoice_items` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`invoice_id` bigint(20) unsigned NOT NULL,
`attendance_id` bigint(20) unsigned NOT NULL,
`description` varchar(255) NOT NULL,
`quantity` int(11) NOT NULL DEFAULT 1,
`unit_price` decimal(8,2) NOT NULL,
`amount` decimal(8,2) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `invoice_items_invoice_id_foreign` (`invoice_id`),
KEY `invoice_items_attendance_id_foreign` (`attendance_id`),
CONSTRAINT `invoice_items_attendance_id_foreign` FOREIGN KEY (`attendance_id`) REFERENCES `lesson_attendances` (`id`) ON DELETE CASCADE,
CONSTRAINT `invoice_items_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `invoices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoices` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`student_id` bigint(20) unsigned NOT NULL,
`period_start` date NOT NULL,
`period_end` date NOT NULL,
`total` decimal(8,2) NOT NULL DEFAULT 0.00,
`status` varchar(255) NOT NULL DEFAULT 'draft',
`pdf_path` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `invoices_student_id_foreign` (`student_id`),
CONSTRAINT `invoices_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `student_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `job_batches`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `job_batches` (
`id` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`total_jobs` int(11) NOT NULL,
`pending_jobs` int(11) NOT NULL,
`failed_jobs` int(11) NOT NULL,
`failed_job_ids` longtext NOT NULL,
`options` mediumtext DEFAULT NULL,
`cancelled_at` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`finished_at` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `jobs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`queue` varchar(255) NOT NULL,
`payload` longtext NOT NULL,
`attempts` tinyint(3) unsigned NOT NULL,
`reserved_at` int(10) unsigned DEFAULT NULL,
`available_at` int(10) unsigned NOT NULL,
`created_at` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lesson_attendances`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lesson_attendances` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`teaching_arrangement_id` bigint(20) unsigned NOT NULL,
`student_teacher_subject_id` bigint(20) unsigned NOT NULL,
`scheduled_start` datetime NOT NULL,
`scheduled_end` datetime NOT NULL,
`actual_start` datetime DEFAULT NULL,
`actual_end` datetime DEFAULT NULL,
`week_of_year` tinyint(4) NOT NULL,
`status` enum('attended','cancelled_by_student','cancelled_by_teacher','no_show','rearranged','sick','centre_closed') NOT NULL,
`billable` tinyint(1) NOT NULL DEFAULT 1,
`payable` tinyint(1) NOT NULL DEFAULT 1,
`notes` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `lesson_attendance_teaching_arrangement_id_foreign` (`teaching_arrangement_id`),
KEY `lesson_attendance_student_teacher_subject_id_foreign` (`student_teacher_subject_id`),
CONSTRAINT `lesson_attendance_student_teacher_subject_id_foreign` FOREIGN KEY (`student_teacher_subject_id`) REFERENCES `student_teacher_subjects` (`id`) ON DELETE CASCADE,
CONSTRAINT `lesson_attendance_teaching_arrangement_id_foreign` FOREIGN KEY (`teaching_arrangement_id`) REFERENCES `teaching_arrangements` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lesson_progress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lesson_progress` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`lesson_id` bigint(20) unsigned NOT NULL,
`completed` tinyint(1) NOT NULL DEFAULT 0,
`last_viewed_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `lesson_progress_user_id_lesson_id_unique` (`user_id`,`lesson_id`),
KEY `lesson_progress_lesson_id_foreign` (`lesson_id`),
CONSTRAINT `lesson_progress_lesson_id_foreign` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`id`) ON DELETE CASCADE,
CONSTRAINT `lesson_progress_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lesson_questions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lesson_questions` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`lesson_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`question` text NOT NULL,
`answer` text DEFAULT NULL,
`published` tinyint(3) unsigned NOT NULL DEFAULT 0,
`answered_by` bigint(20) unsigned DEFAULT NULL,
`answered_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `lesson_questions_lesson_id_foreign` (`lesson_id`),
KEY `lesson_questions_user_id_foreign` (`user_id`),
KEY `lesson_questions_answered_by_foreign` (`answered_by`),
CONSTRAINT `lesson_questions_answered_by_foreign` FOREIGN KEY (`answered_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
CONSTRAINT `lesson_questions_lesson_id_foreign` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`id`) ON DELETE CASCADE,
CONSTRAINT `lesson_questions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lesson_sections`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lesson_sections` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`module_id` bigint(20) unsigned NOT NULL,
`title` varchar(255) NOT NULL DEFAULT 'Year',
`slug` varchar(255) DEFAULT NULL,
`year` tinyint(3) unsigned DEFAULT NULL,
`order` int(10) unsigned NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `lesson_sections_slug_unique` (`slug`),
KEY `lesson_sections_module_id_foreign` (`module_id`),
CONSTRAINT `lesson_sections_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lesson_videos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lesson_videos` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`lesson_id` bigint(20) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`video_url` varchar(255) NOT NULL,
`order` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `lesson_videos_lesson_id_foreign` (`lesson_id`),
CONSTRAINT `lesson_videos_lesson_id_foreign` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `lessons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lessons` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
`order` int(10) unsigned NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`chapter_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `lessons_slug_unique` (`slug`),
KEY `lessons_chapter_id_foreign` (`chapter_id`),
CONSTRAINT `lessons_chapter_id_foreign` FOREIGN KEY (`chapter_id`) REFERENCES `chapters` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `level_subject_teacher`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `level_subject_teacher` (
`teacher_profile_id` bigint(20) unsigned NOT NULL,
`subject_id` bigint(20) unsigned NOT NULL,
`level_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`teacher_profile_id`,`subject_id`,`level_id`),
KEY `level_subject_teacher_subject_id_foreign` (`subject_id`),
KEY `level_subject_teacher_level_id_foreign` (`level_id`),
CONSTRAINT `level_subject_teacher_level_id_foreign` FOREIGN KEY (`level_id`) REFERENCES `levels` (`id`) ON DELETE CASCADE,
CONSTRAINT `level_subject_teacher_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
CONSTRAINT `level_subject_teacher_teacher_profile_id_foreign` FOREIGN KEY (`teacher_profile_id`) REFERENCES `teacher_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `levels`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `levels` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `levels_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `locations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `locations` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`location_name` varchar(255) NOT NULL,
`has_smartboard` tinyint(1) NOT NULL DEFAULT 0,
`has_whiteboard` tinyint(1) NOT NULL DEFAULT 0,
`has_projector` tinyint(1) NOT NULL DEFAULT 0,
`has_computer` tinyint(1) NOT NULL DEFAULT 0,
`has_video_conferencing` tinyint(1) NOT NULL DEFAULT 0,
`computer_quantity` tinyint(4) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `model_has_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_permissions` (
`permission_id` bigint(20) unsigned NOT NULL,
`model_type` varchar(255) NOT NULL,
`model_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `model_has_roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_roles` (
`role_id` bigint(20) unsigned NOT NULL,
`model_type` varchar(255) NOT NULL,
`model_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`role_id`,`model_id`,`model_type`),
KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `modules`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `modules` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`course_id` bigint(20) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`order` int(10) unsigned NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `modules_course_id_foreign` (`course_id`),
CONSTRAINT `modules_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_tokens` (
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `permissions` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`guard_name` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `role_has_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_has_permissions` (
`permission_id` bigint(20) unsigned NOT NULL,
`role_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`permission_id`,`role_id`),
KEY `role_has_permissions_role_id_foreign` (`role_id`),
CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`guard_name` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
`id` varchar(255) NOT NULL,
`user_id` bigint(20) unsigned DEFAULT NULL,
`ip_address` varchar(45) DEFAULT NULL,
`user_agent` text DEFAULT NULL,
`payload` longtext NOT NULL,
`last_activity` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `sessions_user_id_index` (`user_id`),
KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `slots`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `slots` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`weekday` tinyint(3) unsigned NOT NULL,
`time` time NOT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT 1,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `student_profiles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_profiles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`parent_id` bigint(20) unsigned DEFAULT NULL,
`date_of_birth` date DEFAULT NULL,
`notes` text DEFAULT NULL,
`sen_notes` text DEFAULT NULL,
`year_group` varchar(255) DEFAULT NULL,
`has_dyslexia` tinyint(1) NOT NULL DEFAULT 0,
`has_dyspraxia` tinyint(1) NOT NULL DEFAULT 0,
`has_autism` tinyint(1) NOT NULL DEFAULT 0,
`has_adhd` tinyint(1) NOT NULL DEFAULT 0,
`has_speech_needs` tinyint(1) NOT NULL DEFAULT 0,
`student_type_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `student_profiles_student_type_id_foreign` (`student_type_id`),
CONSTRAINT `student_profiles_student_type_id_foreign` FOREIGN KEY (`student_type_id`) REFERENCES `student_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `student_teacher_subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_teacher_subjects` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`student_id` bigint(20) unsigned NOT NULL,
`teacher_id` bigint(20) unsigned NOT NULL,
`subject_id` bigint(20) unsigned NOT NULL,
`rate_override` decimal(8,2) DEFAULT NULL,
`status` varchar(255) NOT NULL DEFAULT 'active',
`notes` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `student_teacher_subject_student_id_foreign` (`student_id`),
KEY `student_teacher_subject_teacher_id_foreign` (`teacher_id`),
KEY `student_teacher_subject_subject_id_foreign` (`subject_id`),
CONSTRAINT `student_teacher_subject_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `student_profiles` (`id`) ON DELETE CASCADE,
CONSTRAINT `student_teacher_subject_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
CONSTRAINT `student_teacher_subject_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teacher_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `student_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `student_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `student_types_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `subjects` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`slug` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `subjects_name_unique` (`name`),
UNIQUE KEY `subjects_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `teacher_pay_items`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teacher_pay_items` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`teacher_pay_period_id` bigint(20) unsigned NOT NULL,
`attendance_id` bigint(20) unsigned NOT NULL,
`hours` decimal(5,2) NOT NULL,
`rate` decimal(8,2) NOT NULL,
`total` decimal(8,2) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `teacher_pay_items_teacher_pay_period_id_foreign` (`teacher_pay_period_id`),
KEY `teacher_pay_items_attendance_id_foreign` (`attendance_id`),
CONSTRAINT `teacher_pay_items_attendance_id_foreign` FOREIGN KEY (`attendance_id`) REFERENCES `lesson_attendances` (`id`) ON DELETE CASCADE,
CONSTRAINT `teacher_pay_items_teacher_pay_period_id_foreign` FOREIGN KEY (`teacher_pay_period_id`) REFERENCES `teacher_pay_periods` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `teacher_pay_periods`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teacher_pay_periods` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`teacher_id` bigint(20) unsigned NOT NULL,
`period_start` date NOT NULL,
`period_end` date NOT NULL,
`total` decimal(8,2) NOT NULL DEFAULT 0.00,
`status` varchar(255) NOT NULL DEFAULT 'draft',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `teacher_pay_periods_teacher_id_foreign` (`teacher_id`),
CONSTRAINT `teacher_pay_periods_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teacher_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `teacher_profiles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teacher_profiles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`ics_token` varchar(64) DEFAULT NULL,
`bio` text DEFAULT NULL,
`qualifications` text DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT 1,
`picture` varchar(255) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
`hourly_rate` decimal(8,2) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `teacher_profiles_user_id_unique` (`user_id`),
UNIQUE KEY `teacher_profiles_ics_token_unique` (`ics_token`),
CONSTRAINT `teacher_profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `teaching_arrangement_students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teaching_arrangement_students` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`teaching_arrangement_id` bigint(20) unsigned NOT NULL,
`student_teacher_subject_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `teaching_arrangement_students_teaching_arrangement_id_foreign` (`teaching_arrangement_id`),
KEY `teaching_arrangement_students_student_teacher_subject_id_foreign` (`student_teacher_subject_id`),
CONSTRAINT `teaching_arrangement_students_student_teacher_subject_id_foreign` FOREIGN KEY (`student_teacher_subject_id`) REFERENCES `student_teacher_subjects` (`id`) ON DELETE CASCADE,
CONSTRAINT `teaching_arrangement_students_teaching_arrangement_id_foreign` FOREIGN KEY (`teaching_arrangement_id`) REFERENCES `teaching_arrangements` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `teaching_arrangements`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `teaching_arrangements` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`teacher_id` bigint(20) unsigned NOT NULL,
`subject_id` bigint(20) unsigned NOT NULL,
`location_id` bigint(20) unsigned DEFAULT NULL,
`weekday` tinyint(4) NOT NULL,
`start_time` time NOT NULL,
`duration_minutes` int(11) NOT NULL,
`is_group` tinyint(1) NOT NULL DEFAULT 0,
`max_students` int(11) DEFAULT NULL,
`fee_policy` varchar(255) NOT NULL DEFAULT 'normal',
`active` tinyint(1) NOT NULL DEFAULT 1,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `teaching_arrangements_teacher_id_foreign` (`teacher_id`),
KEY `teaching_arrangements_subject_id_foreign` (`subject_id`),
KEY `teaching_arrangements_location_id_foreign` (`location_id`),
CONSTRAINT `teaching_arrangements_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE SET NULL,
CONSTRAINT `teaching_arrangements_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
CONSTRAINT `teaching_arrangements_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teacher_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `telescope_entries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `telescope_entries` (
`sequence` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` char(36) NOT NULL,
`batch_id` char(36) NOT NULL,
`family_hash` varchar(255) DEFAULT NULL,
`should_display_on_index` tinyint(1) NOT NULL DEFAULT 1,
`type` varchar(20) NOT NULL,
`content` longtext NOT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`sequence`),
UNIQUE KEY `telescope_entries_uuid_unique` (`uuid`),
KEY `telescope_entries_batch_id_index` (`batch_id`),
KEY `telescope_entries_family_hash_index` (`family_hash`),
KEY `telescope_entries_created_at_index` (`created_at`),
KEY `telescope_entries_type_should_display_on_index_index` (`type`,`should_display_on_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `telescope_entries_tags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `telescope_entries_tags` (
`entry_uuid` char(36) NOT NULL,
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`entry_uuid`,`tag`),
KEY `telescope_entries_tags_tag_index` (`tag`),
CONSTRAINT `telescope_entries_tags_entry_uuid_foreign` FOREIGN KEY (`entry_uuid`) REFERENCES `telescope_entries` (`uuid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `telescope_monitoring`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `telescope_monitoring` (
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) NOT NULL,
`remember_token` varchar(100) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*M!999999\- enable the sandbox mode */
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'0001_01_01_000000_create_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2,'0001_01_01_000001_create_cache_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3,'0001_01_01_000002_create_jobs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4,'2025_09_09_203821_create_permission_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (5,'2025_09_09_204352_create_features_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (6,'2025_09_09_204411_create_telescope_entries_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (7,'2025_09_10_000801_create_courses_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8,'2025_09_10_145118_add_role_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9,'2025_09_11_000940_alter_role_default_on_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10,'2025_09_11_010334_remove_role_column_from_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11,'2025_09_11_103252_create_teacher_profiles_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12,'2025_09_11_103255_create_subjects_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13,'2025_09_11_103258_create_levels_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14,'2025_09_11_103301_create_level_subject_teacher_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15,'2025_09_12_105011_update_courses_table_with_subject_and_level',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (16,'2025_09_12_141116_remove_title_from_courses_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (17,'2025_09_12_141321_remove_title_from_courses_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (18,'2025_09_12_141441_remove_title_from_courses_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (19,'2025_09_12_145930_update_courses_table_lead_teacher_to_foreign',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (20,'2025_09_20_201133_create_modules_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (21,'2025_09_20_201137_create_lesson_sections_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (22,'2025_09_20_201139_create_lessons_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (23,'2025_09_21_000855_create_chapters_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (24,'2025_09_25_001309_create_lesson_videos_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (25,'2025_09_25_004727_remove_video_url_from_lessons_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (26,'2025_09_26_204754_create_slots_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (27,'2025_09_26_204848_create_bookings_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (28,'2025_09_26_223715_remove_lesson_section_id_from_lessons_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (29,'2025_09_27_012432_create_course_user_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (30,'2025_09_27_013114_drop_course_user_table',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (31,'2025_09_27_013231_drop_course_user_table',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (32,'2025_09_27_013420_create_course_user_table',4);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (33,'2025_09_27_174930_add_unique_index_to_lessons_slug',5);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (34,'2025_10_18_211737_add_ics_token_to_teacher_profiles_table',5);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (35,'2025_10_19_172321_create_external_calendars_table',6);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (36,'2025_10_19_172325_create_external_busy_windows_table',6);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (37,'2025_11_08_232702_create_lesson_progress_table',7);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (38,'2025_11_09_014447_add_last_lesson_id_to_course_user_table',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (39,'2025_11_09_155159_add_slug_to_courses_table',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (40,'2025_11_10_230040_create_lesson_questions_table',9);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (41,'2025_11_11_111954_add_published_to_lesson_questions_table',10);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (42,'2025_11_13_124055_add_slug_to_chapters_table',11);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (43,'2025_11_20_134212_add_slug_to_lesson_sections_table',12);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (45,'2025_11_27_155927_add_slug_to_subjects_table',13);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (46,'2025_11_27_164103_create_student_profiles_table',13);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (47,'2025_11_27_164305_create_student_teacher_subject_table',14);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (48,'2025_11_27_214652_create_locations_table',15);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (49,'2025_11_27_214822_create_teaching_arrangements_table',16);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (50,'2025_11_27_215054_create_teaching_arrangement_students_table',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (51,'2025_11_27_215302_create_lesson_attendance_table',18);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (52,'2025_11_27_220103_update_teacher_profiles_add_qualifications_and_active',19);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (53,'2025_11_27_220335_create_invoices_table',20);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (54,'2025_11_27_220429_create_invoice_items_table',21);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (55,'2025_11_27_220532_create_teacher_pay_periods_table',22);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (56,'2025_11_27_220613_create_teacher_pay_items_table',23);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2025_11_29_210900_create_student_types_table',24);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2025_11_29_211113_add_student_type_id_to_student_profiles',24);
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Chapter;
class ChapterSeeder extends Seeder
{
public function run(): void
{
$chapters = [
// Year 1 (lesson_section_id = 1)
['lesson_section_id' => 1, 'title' => 'Algebra', 'order' => 1],
['lesson_section_id' => 1, 'title' => 'Quadratics', 'order' => 2],
['lesson_section_id' => 1, 'title' => 'Functions', 'order' => 3],
['lesson_section_id' => 1, 'title' => 'Graphs', 'order' => 4],
['lesson_section_id' => 1, 'title' => 'Linear Graphs', 'order' => 5],
['lesson_section_id' => 1, 'title' => 'Coordinate Geometry', 'order' => 6],
['lesson_section_id' => 1, 'title' => 'Circles', 'order' => 7],
['lesson_section_id' => 1, 'title' => 'Binomial Expansion', 'order' => 8],
['lesson_section_id' => 1, 'title' => 'Differentiation', 'order' => 9],
['lesson_section_id' => 1, 'title' => 'Integration', 'order' => 10],
['lesson_section_id' => 1, 'title' => 'Exponentials & Logs', 'order' => 11],
['lesson_section_id' => 1, 'title' => 'Trigonometry', 'order' => 12],
['lesson_section_id' => 1, 'title' => 'Trigonometric Graphs', 'order' => 13],
['lesson_section_id' => 1, 'title' => 'Trigonometric Identities & Equations', 'order' => 14],
// Year 2 (lesson_section_id = 2)
['lesson_section_id' => 2, 'title' => 'Algebra', 'order' => 1],
['lesson_section_id' => 2, 'title' => 'Functions', 'order' => 2],
['lesson_section_id' => 2, 'title' => 'Graphs', 'order' => 3],
['lesson_section_id' => 2, 'title' => 'Sequences & Series', 'order' => 4],
['lesson_section_id' => 2, 'title' => 'Binomial Expansion', 'order' => 5],
['lesson_section_id' => 2, 'title' => 'Radian Measure', 'order' => 6],
['lesson_section_id' => 2, 'title' => 'Trigonometry', 'order' => 7],
['lesson_section_id' => 2, 'title' => 'Parametric Equations', 'order' => 8],
['lesson_section_id' => 2, 'title' => 'Differentiation', 'order' => 9],
['lesson_section_id' => 2, 'title' => 'Integration', 'order' => 10],
['lesson_section_id' => 2, 'title' => 'Numerical Methods', 'order' => 11],
['lesson_section_id' => 2, 'title' => 'Vectors', 'order' => 12],
];
foreach ($chapters as $chapter) {
Chapter::updateOrCreate(
[
'lesson_section_id' => $chapter['lesson_section_id'],
'title' => $chapter['title'],
],
[
'order' => $chapter['order'],
]
);
}
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Course;
use App\Models\Level;
use App\Models\Subject;
class CourseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$alevel = Level::where('name', 'A Level')->first();
$aslevel = Level::where('name', 'AS Level')->first();
$maths = Subject::where('name', 'Mathematics')->first();
$physics = Subject::where('name', 'Physics')->first();
$courses = [
[
'subject_id' => $maths->id,
'level_id' => $alevel->id,
'lead_teacher' => "Richard",
],
[
'subject_id' => $physics->id,
'level_id' => $aslevel->id,
'lead_teacher' => "Richard",
],
];
foreach ($courses as $course) {
Course::firstOrCreate($course);
}
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\File;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call([
LevelSeeder::class,
SubjectSeeder::class,
CourseSeeder::class,
ModuleSeeder::class,
LessonSectionSeeder::class, // 👈 must come before
ChapterSeeder::class,
LessonSeeder::class,
SlotSeeder::class,
]);
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\LessonSection;
use App\Models\Module;
class LessonSectionSeeder extends Seeder
{
public function run(): void
{
$pure = Module::where('name', 'Pure Mathematics')->first();
$sections = [
['module_id' => $pure->id, 'title' => 'Year 1', 'order' => 1],
['module_id' => $pure->id, 'title' => 'Year 2', 'order' => 2],
];
foreach ($sections as $section) {
LessonSection::updateOrCreate(
['module_id' => $section['module_id'], 'title' => $section['title']],
$section
);
}
}
}
+242
View File
@@ -0,0 +1,242 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Lesson;
class LessonSeeder extends Seeder
{
public function run(): void
{
$lessons = [
['chapter_id' => 1, 'title' => 'Index Laws', 'description' => 'Index Laws — multiply, divide, (ab)^m and (a^m)^n, simplifying fractions with powers including fractions', 'order' => 1],
['chapter_id' => 1, 'title' => 'Expanding brackets double', 'description' => 'Expanding brackets double and triple brackets with coefficients of x (x + y)(3x - 4)(2x + 5) etc and (a + b + c)(x + y) graphical interpretation', 'order' => 2],
['chapter_id' => 1, 'title' => 'Factorising', 'description' => 'Factorising', 'order' => 3],
['chapter_id' => 1, 'title' => 'Negative and fractional indices', 'description' => 'Negative and fractional indices', 'order' => 4],
['chapter_id' => 1, 'title' => 'Surds', 'description' => 'Surds', 'order' => 5],
['chapter_id' => 2, 'title' => 'Factorising', 'description' => 'Factorising', 'order' => 1],
['chapter_id' => 2, 'title' => 'Solving in completed', 'description' => 'Solving in completed square form, and purpose of CTS, min, max point', 'order' => 2],
['chapter_id' => 2, 'title' => 'Using quadratic formula', 'description' => 'Using quadratic formula', 'order' => 3],
['chapter_id' => 2, 'title' => 'Complete square to solve', 'description' => 'Complete square to solve', 'order' => 4],
['chapter_id' => 2, 'title' => 'Derive QF', 'description' => 'Derive QF', 'order' => 5],
['chapter_id' => 2, 'title' => 'Turning other expressions', 'description' => 'Turning other expressions into quadratics ax + bx^0.5 +c or ax^6 + bx^3 + c with a substitution', 'order' => 6],
['chapter_id' => 2, 'title' => 'The discriminant', 'description' => 'The discriminant', 'order' => 7],
['chapter_id' => 2, 'title' => 'Applications of quadratics', 'description' => 'Applications of quadratics', 'order' => 8],
['chapter_id' => 16, 'title' => 'Naming functions f,', 'description' => 'Naming functions f, g, h, sin, cos, etc. Rules of functions, vertical line test', 'order' => 1],
['chapter_id' => 16, 'title' => 'Subbing a values in ', 'description' => 'Subbing a values in ', 'order' => 2],
['chapter_id' => 16, 'title' => 'Domain restrictions', 'description' => 'Domain restrictions', 'order' => 3],
['chapter_id' => 16, 'title' => 'Inverse functions', 'description' => 'Inverse functions', 'order' => 4],
['chapter_id' => 16, 'title' => 'Simultaneous equations. Solve', 'description' => 'Simultaneous equations. Solve by \'mickey mouse\'', 'order' => 5],
['chapter_id' => 16, 'title' => 'Sim eqs substitution', 'description' => 'Sim eqs substitution', 'order' => 6],
['chapter_id' => 16, 'title' => 'Sim eqs quadratic + linear and Q+Q', 'description' => 'Sim eqs quadratic + linear and Q+Q', 'order' => 7],
['chapter_id' => 16, 'title' => 'Graphical interpretation of the above', 'description' => 'Graphical interpretation of the above', 'order' => 8],
['chapter_id' => 16, 'title' => 'Inequalities - linear', 'description' => 'Inequalities - linear', 'order' => 9],
['chapter_id' => 16, 'title' => 'Inequatlities - quadratics', 'description' => 'Inequatlities - quadratics', 'order' => 10],
['chapter_id' => 16, 'title' => 'Set notation and', 'description' => 'Set notation and graphical representation of < and =<', 'order' => 11],
['chapter_id' => 4, 'title' => 'Cubic graphs, with', 'description' => 'Cubic graphs, with and without certain terms and shapes of graphs. -ve a', 'order' => 1],
['chapter_id' => 4, 'title' => 'Factorised version', 'description' => 'Factorised version', 'order' => 2],
['chapter_id' => 4, 'title' => 'quartic and quintic, odd and even ', 'description' => 'quartic and quintic, odd and even ', 'order' => 3],
['chapter_id' => 4, 'title' => 'Reciprocal graphs and', 'description' => 'Reciprocal graphs and inverse square y = k/x where k can vary', 'order' => 4],
['chapter_id' => 4, 'title' => 'Solutions where f(x)', 'description' => 'Solutions where f(x) = g(x) and f(x) - g(x) = 0', 'order' => 5],
['chapter_id' => 4, 'title' => 'Identifying how many', 'description' => 'Identifying how many solutions exist from clues such as squares, odd/even functions', 'order' => 6],
['chapter_id' => 4, 'title' => 'Transforming graphs', 'description' => 'Transforming graphs', 'order' => 7],
['chapter_id' => 5, 'title' => 'Finding a midpoint of 2 points', 'description' => 'Finding a midpoint of 2 points', 'order' => 1],
['chapter_id' => 5, 'title' => 'Determining gradient from two points', 'description' => 'Determining gradient from two points', 'order' => 2],
['chapter_id' => 5, 'title' => 'Expressing the gradient', 'description' => 'Expressing the gradient in the form y=mx+c', 'order' => 3],
['chapter_id' => 5, 'title' => 'One point known,', 'description' => 'One point known, one point unknown with gradient equation to form y=mx+c', 'order' => 4],
['chapter_id' => 5, 'title' => 'Parallel and perpendicular lines', 'description' => 'Parallel and perpendicular lines', 'order' => 5],
['chapter_id' => 5, 'title' => 'Length of line', 'description' => 'Length of line section and angle. Area underneath', 'order' => 6],
['chapter_id' => 5, 'title' => 'Modelling with straight lines', 'description' => 'Modelling with straight lines', 'order' => 7],
['chapter_id' => 5, 'title' => 'Distinction between perfect', 'description' => 'Distinction between perfect straight line relationships and data', 'order' => 8],
['chapter_id' => 5, 'title' => 'Find perpendicular bisector', 'description' => 'Find perpendicular bisector of two points', 'order' => 9],
['chapter_id' => 6, 'title' => 'Equation of a', 'description' => 'Equation of a circle centred at origin and then transform in x and y. Demonstrate why the equation is what it is', 'order' => 1],
['chapter_id' => 6, 'title' => 'Writing equation from', 'description' => 'Writing equation from centre and radius and writing centre and radius from equation', 'order' => 2],
['chapter_id' => 6, 'title' => 'Find equation from centre and one point', 'description' => 'Find equation from centre and one point', 'order' => 3],
['chapter_id' => 6, 'title' => 'Show that circle', 'description' => 'Show that circle is \'completed square\' version and move between the two', 'order' => 4],
['chapter_id' => 6, 'title' => 'Intersection of straight', 'description' => 'Intersection of straight line and circle, relate to discriminant', 'order' => 5],
['chapter_id' => 6, 'title' => 'Find equation of a tangent at a point', 'description' => 'Find equation of a tangent at a point', 'order' => 6],
['chapter_id' => 6, 'title' => 'Find a circle', 'description' => 'Find a circle from a centre point and a tangent line', 'order' => 7],
['chapter_id' => 6, 'title' => 'Find equation of', 'description' => 'Find equation of a circle from 3 points on the circumfrence and special case of a right angle triangle', 'order' => 8],
['chapter_id' => 7, 'title' => 'Algebraic fractions, simplifying', 'description' => 'Algebraic fractions, simplifying and adding/subtracting', 'order' => 1],
['chapter_id' => 7, 'title' => 'Dividing polynomials both', 'description' => 'Dividing polynomials both with factored versions and where there is a remainder. Show the fraction as a mixed fractioin', 'order' => 2],
['chapter_id' => 7, 'title' => 'Factor Theorem', 'description' => 'Factor Theorem', 'order' => 3],
['chapter_id' => 7, 'title' => 'Remainder Theorem', 'description' => 'Remainder Theorem', 'order' => 4],
['chapter_id' => 7, 'title' => 'Proof. Lots of examples', 'description' => 'Proof. Lots of examples', 'order' => 5],
['chapter_id' => 7, 'title' => 'Proof by exhaustion', 'description' => 'Proof by exhaustion', 'order' => 6],
['chapter_id' => 7, 'title' => 'Proof by counter-example', 'description' => 'Proof by counter-example', 'order' => 7],
['chapter_id' => 8, 'title' => 'Expand brackets reminder', 'description' => 'Expand brackets reminder', 'order' => 1],
['chapter_id' => 8, 'title' => 'Pascal\'s triangle and', 'description' => 'Pascal\'s triangle and application to (x+1)^n', 'order' => 2],
['chapter_id' => 8, 'title' => 'Factorial notation', 'description' => 'Factorial notation', 'order' => 3],
['chapter_id' => 8, 'title' => 'Combination and permutation', 'description' => 'Combination and permutation', 'order' => 4],
['chapter_id' => 8, 'title' => 'Formula for binomial expansion', 'description' => 'Formula for binomial expansion', 'order' => 5],
['chapter_id' => 8, 'title' => 'Binomial problem questions', 'description' => 'Binomial problem questions', 'order' => 6],
['chapter_id' => 8, 'title' => 'Approximation with the', 'description' => 'Approximation with the binomial expansion', 'order' => 7],
['chapter_id' => 8, 'title' => 'Convergence vs divergence', 'description' => 'Convergence vs divergence', 'order' => 8],
['chapter_id' => 8, 'title' => 'questions inspired by the book', 'description' => 'questions inspired by the book', 'order' => 9],
['chapter_id' => 9, 'title' => 'Sine rule', 'description' => 'Sine rule', 'order' => 1],
['chapter_id' => 9, 'title' => 'Cosine rule', 'description' => 'Cosine rule', 'order' => 2],
['chapter_id' => 9, 'title' => 'Sine and Cosine rule with bearings', 'description' => 'Sine and Cosine rule with bearings', 'order' => 3],
['chapter_id' => 9, 'title' => 'Area of triangle 0.5absinC', 'description' => 'Area of triangle 0.5absinC', 'order' => 4],
['chapter_id' => 9, 'title' => 'Graphs of sin, cos and tan', 'description' => 'Graphs of sin, cos and tan', 'order' => 5],
['chapter_id' => 9, 'title' => 'Transforming the graphs', 'description' => 'Transforming the graphs', 'order' => 6],
['chapter_id' => 10, 'title' => 'Show how Sine,', 'description' => 'Show how Sine, Cosine, and Tangent come to be from the unit circle', 'order' => 1],
['chapter_id' => 10, 'title' => 'Drawing graphs to', 'description' => 'Drawing graphs to determine sign of values', 'order' => 2],
['chapter_id' => 10, 'title' => 'Exact values of sin, cos and tan', 'description' => 'Exact values of sin, cos and tan', 'order' => 3],
['chapter_id' => 10, 'title' => 'Use exact values', 'description' => 'Use exact values to determine exact values at other angles', 'order' => 4],
['chapter_id' => 10, 'title' => 'tan = sin/cos', 'description' => 'tan = sin/cos', 'order' => 5],
['chapter_id' => 10, 'title' => 'Pythagorean identity', 'description' => 'Pythagorean identity', 'order' => 6],
['chapter_id' => 10, 'title' => 'Simplifying/manipulating trig equations', 'description' => 'Simplifying/manipulating trig equations', 'order' => 7],
['chapter_id' => 10, 'title' => 'Solving trig equation', 'description' => 'Solving trig equation in certain range and How calculator gives inverse values ', 'order' => 8],
['chapter_id' => 10, 'title' => 'Solving trig equation', 'description' => 'Solving trig equation when graph has been transformed with enlargements or translations', 'order' => 9],
['chapter_id' => 10, 'title' => 'Quadratics with trig', 'description' => 'Quadratics with trig equations built in. As touched on in quadratics', 'order' => 10],
['chapter_id' => 26, 'title' => 'Combining vectors', 'description' => 'Combining vectors', 'order' => 1],
['chapter_id' => 26, 'title' => 'Parallel vectors', 'description' => 'Parallel vectors', 'order' => 2],
['chapter_id' => 26, 'title' => 'Multiples of vectors', 'description' => 'Multiples of vectors', 'order' => 3],
['chapter_id' => 26, 'title' => 'pi + qj notation', 'description' => 'pi + qj notation', 'order' => 4],
['chapter_id' => 26, 'title' => 'Magnitude and Direction', 'description' => 'Magnitude and Direction', 'order' => 5],
['chapter_id' => 26, 'title' => 'Positiono vectors', 'description' => 'Positiono vectors', 'order' => 6],
['chapter_id' => 26, 'title' => 'Geometric problems (see 11.5)', 'description' => 'Geometric problems (see 11.5)', 'order' => 7],
['chapter_id' => 26, 'title' => 'Modelling with vectors', 'description' => 'Modelling with vectors', 'order' => 8],
['chapter_id' => 23, 'title' => 'Gradient of tangent to curve', 'description' => 'Gradient of tangent to curve', 'order' => 1],
['chapter_id' => 23, 'title' => 'Estimating tangent from chord', 'description' => 'Estimating tangent from chord', 'order' => 2],
['chapter_id' => 23, 'title' => 'Diff from first principles', 'description' => 'Diff from first principles', 'order' => 3],
['chapter_id' => 23, 'title' => 'Leibniz and Newton\'s notation', 'description' => 'Leibniz and Newton\'s notation', 'order' => 4],
['chapter_id' => 23, 'title' => 'Differentiating x^n', 'description' => 'Differentiating x^n', 'order' => 5],
['chapter_id' => 23, 'title' => 'FTOC', 'description' => 'FTOC', 'order' => 6],
['chapter_id' => 23, 'title' => 'Differentiating polynomials', 'description' => 'Differentiating polynomials', 'order' => 7],
['chapter_id' => 23, 'title' => 'Differentiating non-integer powers', 'description' => 'Differentiating non-integer powers', 'order' => 8],
['chapter_id' => 23, 'title' => 'Gradients of tangents and normals', 'description' => 'Gradients of tangents and normals', 'order' => 9],
['chapter_id' => 23, 'title' => 'Find equation of', 'description' => 'Find equation of tangent at a particular point', 'order' => 10],
['chapter_id' => 23, 'title' => 'Increasing and decreasing', 'description' => 'Increasing and decreasing functions and relation to derivative', 'order' => 11],
['chapter_id' => 23, 'title' => 'Second derivative notation ', 'description' => 'Second derivative notation ', 'order' => 12],
['chapter_id' => 23, 'title' => 'Stationary points and', 'description' => 'Stationary points and their nature from first and second derivatives', 'order' => 13],
['chapter_id' => 23, 'title' => 'Sketching derivative functions', 'description' => 'Sketching derivative functions', 'order' => 14],
['chapter_id' => 23, 'title' => 'Modelling with differentiation ', 'description' => 'Modelling with differentiation ', 'order' => 15],
['chapter_id' => 13, 'title' => 'Introduction: Areas under curves', 'description' => 'Introduction: Areas under curves', 'order' => 1],
['chapter_id' => 13, 'title' => 'Process of integration', 'description' => 'Process of integration -> backwards differentiation including constant of int Reminder of FTOC and application here', 'order' => 2],
['chapter_id' => 13, 'title' => 'Notation of indefinite integrals', 'description' => 'Notation of indefinite integrals', 'order' => 3],
['chapter_id' => 13, 'title' => 'Determining the constant of integration', 'description' => 'Determining the constant of integration', 'order' => 4],
['chapter_id' => 13, 'title' => 'Definite integrals', 'description' => 'Definite integrals', 'order' => 5],
['chapter_id' => 13, 'title' => 'Proof', 'description' => 'Proof', 'order' => 6],
['chapter_id' => 13, 'title' => 'Areas between curves and lines', 'description' => 'Areas between curves and lines', 'order' => 7],
['chapter_id' => 13, 'title' => 'Areas between curves and curves', 'description' => 'Areas between curves and curves', 'order' => 8],
['chapter_id' => 14, 'title' => 'Definition of exponential', 'description' => 'Definition of exponential functions and their graphs', 'order' => 1],
['chapter_id' => 14, 'title' => 'Where does \'e\'', 'description' => 'Where does \'e\' come from and the graph of y = e^x', 'order' => 2],
['chapter_id' => 14, 'title' => 'derivative of e^x and e^kx', 'description' => 'derivative of e^x and e^kx', 'order' => 3],
['chapter_id' => 14, 'title' => 'Modelling with exponentials', 'description' => 'Modelling with exponentials', 'order' => 4],
['chapter_id' => 14, 'title' => 'Logs as inverse', 'description' => 'Logs as inverse functions of exponentials and their notation', 'order' => 5],
['chapter_id' => 14, 'title' => 'Laws of logs', 'description' => 'Laws of logs', 'order' => 6],
['chapter_id' => 14, 'title' => 'Solving equations involving logs', 'description' => 'Solving equations involving logs', 'order' => 7],
['chapter_id' => 14, 'title' => 'Solving equations using logs', 'description' => 'Solving equations using logs', 'order' => 8],
['chapter_id' => 14, 'title' => 'The natural logarithm', 'description' => 'The natural logarithm', 'order' => 9],
['chapter_id' => 14, 'title' => 'Using logs to', 'description' => 'Using logs to represent non-linear data in a linear way', 'order' => 10],
['chapter_id' => 15, 'title' => 'Proof by contradiction', 'description' => 'Proof by contradiction', 'order' => 1],
['chapter_id' => 15, 'title' => 'Recap of fractioni addition', 'description' => 'Recap of fractioni addition', 'order' => 2],
['chapter_id' => 15, 'title' => 'Partial fractions intro', 'description' => 'Partial fractions intro', 'order' => 3],
['chapter_id' => 15, 'title' => 'Partial fractions with repeated factors', 'description' => 'Partial fractions with repeated factors', 'order' => 4],
['chapter_id' => 15, 'title' => 'Application of PFs', 'description' => 'Application of PFs with algebraic division', 'order' => 5],
['chapter_id' => 16, 'title' => 'Modulus function', 'description' => 'Modulus function', 'order' => 1],
['chapter_id' => 16, 'title' => 'Graphing functions with the modulus', 'description' => 'Graphing functions with the modulus', 'order' => 2],
['chapter_id' => 16, 'title' => 'Solving equations with', 'description' => 'Solving equations with modulus function (points of intersection)', 'order' => 3],
['chapter_id' => 16, 'title' => 'Mappings and recap', 'description' => 'Mappings and recap of types of functions (1-1, many-1 etc) discontinuities', 'order' => 4],
['chapter_id' => 16, 'title' => 'piecewise functions', 'description' => 'piecewise functions', 'order' => 5],
['chapter_id' => 16, 'title' => 'Composition of functions', 'description' => 'Composition of functions', 'order' => 6],
['chapter_id' => 16, 'title' => 'Inverse functions', 'description' => 'Inverse functions', 'order' => 7],
['chapter_id' => 16, 'title' => 'recap of graph', 'description' => 'recap of graph transforms and combinations of them', 'order' => 8],
['chapter_id' => 16, 'title' => 'Combining modulus and', 'description' => 'Combining modulus and graph transformations', 'order' => 9],
['chapter_id' => 17, 'title' => 'Index notation', 'description' => 'Index notation', 'order' => 1],
['chapter_id' => 17, 'title' => 'Arithmetic sequences', 'description' => 'Arithmetic sequences', 'order' => 2],
['chapter_id' => 17, 'title' => 'AS equations', 'description' => 'AS equations', 'order' => 3],
['chapter_id' => 17, 'title' => 'Geometric sequences', 'description' => 'Geometric sequences', 'order' => 4],
['chapter_id' => 17, 'title' => 'GS equations', 'description' => 'GS equations', 'order' => 5],
['chapter_id' => 17, 'title' => 'Sum to infinity', 'description' => 'Sum to infinity', 'order' => 6],
['chapter_id' => 17, 'title' => 'Divergence and convergence', 'description' => 'Divergence and convergence', 'order' => 7],
['chapter_id' => 17, 'title' => 'Sigma notation', 'description' => 'Sigma notation', 'order' => 8],
['chapter_id' => 17, 'title' => 'Recurrence relations', 'description' => 'Recurrence relations', 'order' => 9],
['chapter_id' => 17, 'title' => 'Modelling with series', 'description' => 'Modelling with series', 'order' => 10],
['chapter_id' => 18, 'title' => 'Recap of year 1', 'description' => 'Recap of year 1', 'order' => 1],
['chapter_id' => 18, 'title' => 'New binomial equation', 'description' => 'New binomial equation and approximation with it', 'order' => 2],
['chapter_id' => 18, 'title' => 'Non-integer power examples', 'description' => 'Non-integer power examples', 'order' => 3],
['chapter_id' => 18, 'title' => 'Valid range of expansion', 'description' => 'Valid range of expansion', 'order' => 4],
['chapter_id' => 18, 'title' => 'Partial fractions with expansions', 'description' => 'Partial fractions with expansions', 'order' => 5],
['chapter_id' => 18, 'title' => 'Application to approximating', 'description' => 'Application to approximating actual values', 'order' => 6],
['chapter_id' => 19, 'title' => 'Definition of a', 'description' => 'Definition of a radian and derivation of 2pir and pirsqr', 'order' => 1],
['chapter_id' => 19, 'title' => 'Converting radians to degrees and back', 'description' => 'Converting radians to degrees and back', 'order' => 2],
['chapter_id' => 19, 'title' => 'Trig functions with radians', 'description' => 'Trig functions with radians', 'order' => 3],
['chapter_id' => 19, 'title' => 'Areas of sectors and segments', 'description' => 'Areas of sectors and segments', 'order' => 4],
['chapter_id' => 19, 'title' => 'Lengths of arcs', 'description' => 'Lengths of arcs', 'order' => 5],
['chapter_id' => 19, 'title' => 'Solutions of trig cuntions in radians', 'description' => 'Solutions of trig cuntions in radians', 'order' => 6],
['chapter_id' => 19, 'title' => 'Small angle approximations', 'description' => 'Small angle approximations', 'order' => 7],
['chapter_id' => 20, 'title' => 'sec, cosec cot graphs and valuesd', 'description' => 'sec, cosec cot graphs and valuesd', 'order' => 1],
['chapter_id' => 20, 'title' => 'Transformations of new graphs', 'description' => 'Transformations of new graphs', 'order' => 2],
['chapter_id' => 20, 'title' => 'Proving trig equations', 'description' => 'Proving trig equations', 'order' => 3],
['chapter_id' => 20, 'title' => 'New trig IDs', 'description' => 'New trig IDs', 'order' => 4],
['chapter_id' => 20, 'title' => 'Converting exact values', 'description' => 'Converting exact values between the 6 trig functions', 'order' => 5],
['chapter_id' => 20, 'title' => 'Inverse trig functions', 'description' => 'Inverse trig functions and limitations with graphs', 'order' => 6],
['chapter_id' => 20, 'title' => 'inverse functions as roots of 1-x etc', 'description' => 'inverse functions as roots of 1-x etc', 'order' => 7],
['chapter_id' => 21, 'title' => 'Introduction to compound angle formulae', 'description' => 'Introduction to compound angle formulae', 'order' => 1],
['chapter_id' => 21, 'title' => 'Proof of them', 'description' => 'Proof of them', 'order' => 2],
['chapter_id' => 21, 'title' => 'Exact values of', 'description' => 'Exact values of new values in trig functions', 'order' => 3],
['chapter_id' => 21, 'title' => 'Double angle formulae', 'description' => 'Double angle formulae', 'order' => 4],
['chapter_id' => 21, 'title' => 'Simplify acosx +- bsinx', 'description' => 'Simplify acosx +- bsinx', 'order' => 5],
['chapter_id' => 21, 'title' => 'Prove more trig IDs', 'description' => 'Prove more trig IDs', 'order' => 6],
['chapter_id' => 21, 'title' => 'Combining double angle', 'description' => 'Combining double angle with pythagorean ID', 'order' => 7],
['chapter_id' => 21, 'title' => 'Modelling examples', 'description' => 'Modelling examples', 'order' => 8],
['chapter_id' => 22, 'title' => 'Introduction to ideas', 'description' => 'Introduction to ideas', 'order' => 1],
['chapter_id' => 22, 'title' => 'Converting parametric to Cartesian', 'description' => 'Converting parametric to Cartesian', 'order' => 2],
['chapter_id' => 22, 'title' => 'Trig IDs in parametric equations', 'description' => 'Trig IDs in parametric equations', 'order' => 3],
['chapter_id' => 22, 'title' => 'Sketching curves from parametric EQs', 'description' => 'Sketching curves from parametric EQs', 'order' => 4],
['chapter_id' => 22, 'title' => 'Points of intersection', 'description' => 'Points of intersection with co-ordinate axes', 'order' => 5],
['chapter_id' => 22, 'title' => 'Start and end', 'description' => 'Start and end points of parametrically defined curves', 'order' => 6],
['chapter_id' => 22, 'title' => 'Modelling', 'description' => 'Modelling', 'order' => 7],
['chapter_id' => 23, 'title' => 'Differentiating trig functions', 'description' => 'Differentiating trig functions', 'order' => 1],
['chapter_id' => 23, 'title' => 'Differentiating logs and exponentials', 'description' => 'Differentiating logs and exponentials', 'order' => 2],
['chapter_id' => 23, 'title' => 'Chain Rule', 'description' => 'Chain Rule', 'order' => 3],
['chapter_id' => 23, 'title' => 'Product Rule', 'description' => 'Product Rule', 'order' => 4],
['chapter_id' => 23, 'title' => 'Quotient Rules', 'description' => 'Quotient Rules', 'order' => 5],
['chapter_id' => 23, 'title' => 'Differentiating trig functions', 'description' => 'Differentiating trig functions', 'order' => 6],
['chapter_id' => 23, 'title' => 'Differentiating inverse trig functions', 'description' => 'Differentiating inverse trig functions', 'order' => 7],
['chapter_id' => 23, 'title' => 'Parametric differentiation using', 'description' => 'Parametric differentiation using chain rule', 'order' => 8],
['chapter_id' => 23, 'title' => 'Implicit differentiation', 'description' => 'Implicit differentiation', 'order' => 9],
['chapter_id' => 23, 'title' => 'Convex and Concave', 'description' => 'Convex and Concave regions and inflection points', 'order' => 10],
['chapter_id' => 23, 'title' => 'Rates of change and modelling', 'description' => 'Rates of change and modelling', 'order' => 11],
['chapter_id' => 24, 'title' => 'Recap roots of', 'description' => 'Recap roots of functions and their location for polynomial functions. Being careful with locations', 'order' => 1],
['chapter_id' => 24, 'title' => 'Positive and negative', 'description' => 'Positive and negative values either side of a root', 'order' => 2],
['chapter_id' => 24, 'title' => 'Iteration staircase', 'description' => 'Iteration staircase', 'order' => 3],
['chapter_id' => 24, 'title' => 'Iteration spiders web', 'description' => 'Iteration spiders web', 'order' => 4],
['chapter_id' => 24, 'title' => 'Newton Raphson', 'description' => 'Newton Raphson', 'order' => 5],
['chapter_id' => 24, 'title' => 'Modelliing', 'description' => 'Modelliing', 'order' => 6],
['chapter_id' => 25, 'title' => 'Integration table', 'description' => 'Integration table', 'order' => 1],
['chapter_id' => 25, 'title' => 'Reverse Chain rule', 'description' => 'Reverse Chain rule', 'order' => 2],
['chapter_id' => 25, 'title' => 'Subbing trig functions', 'description' => 'Subbing trig functions', 'order' => 3],
['chapter_id' => 25, 'title' => 'Integration by substitution', 'description' => 'Integration by substitution', 'order' => 4],
['chapter_id' => 25, 'title' => 'Integration by Parts', 'description' => 'Integration by Parts', 'order' => 5],
['chapter_id' => 25, 'title' => 'Partial fractions with integration', 'description' => 'Partial fractions with integration', 'order' => 6],
['chapter_id' => 25, 'title' => 'Recap of areas and new examples', 'description' => 'Recap of areas and new examples', 'order' => 7],
['chapter_id' => 25, 'title' => 'Trapezium rule', 'description' => 'Trapezium rule', 'order' => 8],
['chapter_id' => 25, 'title' => 'Differential equations', 'description' => 'Differential equations', 'order' => 9],
['chapter_id' => 25, 'title' => 'Modelling with DEs', 'description' => 'Modelling with DEs', 'order' => 10],
['chapter_id' => 26, 'title' => '3D co-ordinates', 'description' => '3D co-ordinates', 'order' => 1],
['chapter_id' => 26, 'title' => '3D Pythagoras', 'description' => '3D Pythagoras', 'order' => 2],
['chapter_id' => 26, 'title' => 'ikj notation of', 'description' => 'ikj notation of vectors and the unit vector', 'order' => 3],
['chapter_id' => 26, 'title' => 'Magnitude of vectors', 'description' => 'Magnitude of vectors', 'order' => 4],
['chapter_id' => 26, 'title' => 'Unit vector along a vector', 'description' => 'Unit vector along a vector', 'order' => 5],
['chapter_id' => 26, 'title' => 'Applying to geometric shapes', 'description' => 'Applying to geometric shapes', 'order' => 6],
['chapter_id' => 26, 'title' => 'Connection to Mech', 'description' => 'Connection to Mech', 'order' => 7],
];
foreach ($lessons as $lesson) {
Lesson::updateOrCreate(
[
'chapter_id' => $lesson['chapter_id'],
'title' => $lesson['title'],
],
[
'description' => $lesson['description'],
'order' => $lesson['order'],
]
);
}
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Level;
class LevelSeeder extends Seeder
{
public function run(): void
{
$levels = [
['name' => 'AS Level'],
['name' => 'A Level'],
];
foreach ($levels as $level) {
Level::firstOrCreate(['name' => $level['name']], $level);
}
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Module;
use App\Models\Course;
use App\Models\Level;
use App\Models\Subject;
class ModuleSeeder extends Seeder
{
public function run(): void
{
$alevel = Level::where('name', 'A Level')->first();
$maths = Subject::where('name', 'Mathematics')->first();
$mathsCourse = Course::where('level_id', $alevel->id)
->where('subject_id', $maths->id)
->first();
if (!$mathsCourse) {
$this->command->warn('Maths course not found, skipping ModuleSeeder.');
return;
}
$modules = [
['course_id' => $mathsCourse->id, 'name' => 'Pure Mathematics', 'order' => 1],
['course_id' => $mathsCourse->id, 'name' => 'Statistics', 'order' => 2],
];
foreach ($modules as $module) {
Module::updateOrCreate(
['course_id' => $module['course_id'], 'name' => $module['name']],
$module
);
}
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class PermissionSeeder extends Seeder
{
public function run(): void
{
// Define permissions your app actually uses
$permissions = [
'view dashboard',
'manage courses',
'manage users',
];
foreach ($permissions as $perm) {
Permission::firstOrCreate(['name' => $perm, 'guard_name' => 'web']);
}
// Assign to roles
$admin = Role::where('name', 'admin')->first();
$teacher = Role::where('name', 'teacher')->first();
$student = Role::where('name', 'student')->first();
if ($admin) {
$admin->givePermissionTo($permissions); // admin gets all
}
if ($teacher) {
$teacher->givePermissionTo(['view dashboard', 'manage courses']);
}
if ($student) {
$student->givePermissionTo(['view dashboard']);
}
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class RoleSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$roles = ['admin', 'teacher', 'student'];
foreach ($roles as $role) {
Role::firstOrCreate(
['name' => $role, 'guard_name' => 'web']
);
}
}
}
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RolesAndPermissionsSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Slot;
use Illuminate\Support\Facades\DB;
class SlotSeeder extends Seeder
{
public function run(): void
{
// Weekdays: 1 = Monday, 5 = Friday
$weekdays = [1, 2, 3, 4, 5];
// Session times
$times = [
'09:00:00',
'10:00:00',
'11:00:00',
'14:00:00',
'15:00:00',
'16:00:00',
];
$slots = [];
$now = now();
foreach ($weekdays as $weekday) {
foreach ($times as $time) {
$slots[] = [
'weekday' => $weekday,
'time' => $time,
'is_active' => 1,
'created_at' => $now,
'updated_at' => $now,
];
}
}
DB::table('slots')->insert($slots);
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class StudentTypesSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('student_types')->insert([
['name' => 'online', 'description' => 'Online-only student'],
['name' => 'centre_full_time', 'description' => 'Full-time centre student'],
['name' => 'centre_part_time', 'description' => 'Part-time centre student'],
['name' => 'hybrid', 'description' => 'Online + in person'],
['name' => 'trainee_teacher', 'description' => 'Teacher-in-training'],
]);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Subject;
class SubjectSeeder extends Seeder
{
public function run(): void
{
$subjects = [
['name' => 'Mathematics'],
['name' => 'Physics'],
];
foreach ($subjects as $subject) {
Subject::firstOrCreate(['name' => $subject['name']], $subject);
}
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Models\Role;
class UserSeeder extends Seeder
{
public function run(): void
{
// Ensure roles exist
$roles = ['admin', 'teacher', 'student'];
foreach ($roles as $role) {
Role::firstOrCreate(
['name' => $role, 'guard_name' => 'web']
);
}
// Create a default admin user
$admin = User::firstOrCreate(
['email' => 'admin@example.com'],
[
'name' => 'Admin User',
'password' => Hash::make('password'), // change to something secure later
]
);
// Assign role
if (!$admin->hasRole('admin')) {
$admin->assignRole('admin');
}
}
}