<?php
/**
 * Created by PhpStorm.
 * User: Vladimir
 * Date: 07.03.2018
 * Time: 1:44
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{

    public function subcategory()
    {
        return $this->hasMany('App\Models\Subcategory');
    }

    public static function getCategoriesWithSubcategories()
    {
        return Category::with('subcategory')->get();
    }
}