diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php new file mode 100644 index 0000000..364811d --- /dev/null +++ b/app/Http/Controllers/DocumentController.php @@ -0,0 +1,65 @@ + $this->uuid, + 'title' => $this->title, + 'html' => $this->html, + 'json' => $this->json, + 'state' => $this->state, + 'user' => $this->user, + ]; + } + + public function state() + { + return $this->belongsTo(DocumentState::class); + } + + public function user() + { + return $this->belongsTo(User::class); + } +} diff --git a/app/Models/DocumentState.php b/app/Models/DocumentState.php new file mode 100644 index 0000000..695c8d3 --- /dev/null +++ b/app/Models/DocumentState.php @@ -0,0 +1,26 @@ + $this->uuid, + 'name' => $this->name, + ]; + } + + public function documents() + { + return $this->hasMany(Document::class); + } +} diff --git a/database/migrations/2025_04_26_184348_create_document_states.php b/database/migrations/2025_04_26_184348_create_document_states.php new file mode 100644 index 0000000..39b0c2b --- /dev/null +++ b/database/migrations/2025_04_26_184348_create_document_states.php @@ -0,0 +1,35 @@ +id(); + $table->string("name"); + $table->timestamps(); + }); + + DocumentState::create(["name"=> "Brouillon"]); + DocumentState::create(["name"=> "Public"]); + DocumentState::create(["name"=> "Privé"]); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('document_states'); + } +}; diff --git a/database/migrations/2025_04_26_223135_create_documents.php b/database/migrations/2025_04_26_223135_create_documents.php new file mode 100644 index 0000000..96c2cfc --- /dev/null +++ b/database/migrations/2025_04_26_223135_create_documents.php @@ -0,0 +1,36 @@ +id(); + $table->uuid('uuid')->unique(); + $table->string("title"); + $table->text("html"); + $table->json("json"); + $table->unsignedBigInteger("document_state_id"); + $table->unsignedBigInteger("user_id"); + $table->timestamps(); + + $table->foreign("user_id")->references("id")->on("users"); + $table->foreign("document_state_id")->references("id")->on("document_states"); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('documents'); + } +}; diff --git a/public/img/new-logo.png b/public/img/new-logo.png new file mode 100644 index 0000000..f25fc40 Binary files /dev/null and b/public/img/new-logo.png differ