commit 344b1e530f90537512bb23c4194f4e2f197dd6d0
Author: zabran <zabran@students.zcu.cz>
Date:   Fri Mar 20 14:09:26 2020 +0100

    Vytvoření datového a objektového modelu. Netestováno!
    Issue #7692 @2

diff --git a/app/Artefact.php b/app/Artefact.php
new file mode 100644
index 0000000..9396cc6
--- /dev/null
+++ b/app/Artefact.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Artefact extends Model
+{
+    // Table Name
+    protected $table = 'artafacts';//unnecessery?
+    // Primary Key
+    public $primaryKey = 'id';//unnecessery?
+
+    /**
+     * The model's default values for attributes.
+     *
+     * @var array
+     */
+    protected $attributes = [
+        'likes' => 0,
+    ];
+
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public $timestamps = false;
+
+    /**
+     * Get the metadata for the artefact.
+     */
+    public function metadata()
+    {
+        return $this->hasMany('App\Metadata');
+    }
+
+    /**
+     * Get the categories for the artefact.
+     */
+    public function categories()
+    {
+        return $this->belongsToMany('App\Category');
+    }
+
+
+
+
+}
diff --git a/app/Category.php b/app/Category.php
new file mode 100644
index 0000000..9fe6fb0
--- /dev/null
+++ b/app/Category.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Category extends Model
+{
+    // Table Name
+    protected $table = 'categories';
+    // Primary Key
+    public $primaryKey = 'id';//unnecessery?
+
+
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public $timestamps = false;
+
+    /**
+     * Get the artefacts for the catagory.
+     */
+    public function atrefacts()
+    {
+        return $this->belongsToMany('App\Artefact');
+    }
+
+
+}
diff --git a/app/Metadata.php b/app/Metadata.php
new file mode 100644
index 0000000..529804e
--- /dev/null
+++ b/app/Metadata.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Metadata extends Model
+{
+    // Table Name
+    protected $table = 'metadata';//same name could make problems
+    // Primary Key
+    public $primaryKey = 'id';//unnecessery?
+
+    /**
+     * The model's default values for attributes.
+     *
+     * @var array
+     */
+    protected $attributes = [
+        'likes' => 0,
+    ];
+
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public $timestamps = false;
+
+    /**
+     * Get the artafact for this single metadata.
+     */
+    public function artefact(){
+        return $this->belongsTo('App\Artefact');
+    }
+
+
+}
diff --git a/database/migrations/CreateArtefactsTable.php b/database/migrations/CreateArtefactsTable.php
new file mode 100644
index 0000000..d79270e
--- /dev/null
+++ b/database/migrations/CreateArtefactsTable.php
@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateArtefactsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('artefacts', function (Blueprint $table) {
+            $table->id();
+            $table->string('name');
+            $table->string('author');
+            $table->string('made_in');
+            $table->string('publisher');
+            $table->integer('year');
+            $table->integer('pages');
+            $table->integer('likes');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('artefacts');
+    }
+}
diff --git a/database/migrations/CreateCategoryTable.php b/database/migrations/CreateCategoryTable.php
new file mode 100644
index 0000000..4b268da
--- /dev/null
+++ b/database/migrations/CreateCategoryTable.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCategoryTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('categories', function (Blueprint $table) {
+            $table->id();
+
+            $table->string('nameCZ');
+            $table->string('nameEN');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('categories');
+    }
+}
diff --git a/database/migrations/CreateMetadataTable.php b/database/migrations/CreateMetadataTable.php
new file mode 100644
index 0000000..3cbce77
--- /dev/null
+++ b/database/migrations/CreateMetadataTable.php
@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMetadataTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('metadata', function (Blueprint $table) {
+            $table->id();
+            $table->integer('artefact_id')->unsigned();
+            $table->foreign('artefact_id')->references('id')->on('artefacts');
+
+            $table->string('name');
+            $table->longText('noteCZ');
+            $table->longText('noteEN');
+
+            $table->integer('page');
+            $table->integer('likes');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('metadata');
+    }
+}
