diff --git a/skolehjem/app/Album.php b/skolehjem/app/Album.php index e8571ed..e32fee6 100644 --- a/skolehjem/app/Album.php +++ b/skolehjem/app/Album.php @@ -6,5 +6,22 @@ use Illuminate\Database\Eloquent\Model; class Album extends Model { - // + protected $fillable = [ + 'name' + ]; + + public function parentAlbum() + { + return $this->belongsTo('App\Album'); + } + + public function images() + { + return $this->hasMany('App\Image'); + } + + public function videos() + { + return $this->hasMany('App\Video'); + } } diff --git a/skolehjem/app/Image.php b/skolehjem/app/Image.php deleted file mode 100644 index bbb58f5..0000000 --- a/skolehjem/app/Image.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App; - -use Illuminate\Database\Eloquent\Model; - -class Image extends Model -{ - // -} diff --git a/skolehjem/app/Video.php b/skolehjem/app/Video.php deleted file mode 100644 index 965f983..0000000 --- a/skolehjem/app/Video.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App; - -use Illuminate\Database\Eloquent\Model; - -class Video extends Model -{ - // -} diff --git a/skolehjem/database/migrations/2020_06_30_065200_create_images_table.php b/skolehjem/database/migrations/2020_06_30_065200_create_images_table.php deleted file mode 100644 index 0ec15bd..0000000 --- a/skolehjem/database/migrations/2020_06_30_065200_create_images_table.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreateImagesTable extends Migration -{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('images', function (Blueprint $table) { - $table->id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('images'); - } -} diff --git a/skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php b/skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php deleted file mode 100644 index fa4dc4d..0000000 --- a/skolehjem/database/migrations/2020_06_30_065206_create_videos_table.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreateVideosTable extends Migration -{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('videos', function (Blueprint $table) { - $table->id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('videos'); - } -}