<?php

//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none needed. the class should appear empty.

//Reference to where the file belongs.
namespace App;

//allows the use of Model library
use Illuminate\Database\Eloquent\Model;

//Class of which should extend Model Library
class Album extends Model
{
    //protected variable which contains name of database field(s) to be filled.
    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');
    }
}