??????????????
<?php

namespace App;

use Illuminate\Database\Eloquent\Model; 
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Libs\Sum;
use App\Artist;


class Orders extends Model
{

    use SoftDeletes;

    /**
     * The attributes that should be mutated to dates.
     *
     * @var array
     */
    protected $dates = ['deleted_at'];

    protected $table = 'orders';

    protected $fillable = [
        'user_id',
        'manager_id',
        'client_id',
        'width',
        'height',
        'size',
        'catalogs_id',
        'artist_id',
        'picture',
        'payd',
        'picture_data',
        'price',
        'putdate',
        'putdate_end',
        'saloon_id',
        'status',
        'type'
    ];

 

    public function user()
    {
        return $this->hasOne('App\User', 'id', 'user_id');
    }

    public function clients()
    {
        return $this->hasOne('App\Client', 'id', 'client_id');
    }

    public function sizes()
    {
        return $this->hasOne('App\Size', 'id', 'sizes_id');
    }

    public function saloons()
    {
        return $this->hasOne('App\Saloon', 'id', 'saloon_id');
    }

    public function catalogs()
    {
        return $this->hasOne('App\Catalogs', 'id', 'catalogs_id');
    }

    public function artists()
    {
        return $this->hasOne('App\Artist', 'id', 'artist_id');
    }

    public function pictures()
    {
        return $this->hasOne('App\Picture', 'id', 'picture_data');
    }

    public function picturem()
    {
        return $this->hasOne('App\PictureManager', 'id', 'picture');
    }

    public function orders()
    {
        return $this->hasMany('App\Ordersmanager', 'order_id');
    }

    public function oldartists()
    {
        return $this->hasMany('App\Artistschange', 'order_id');
    }

    public function prices($cat_id = 0, $sum = 0)
    {
        $sto = new Sum;
        $size = $sto->getSum($sum);
        $real_s = Size::where('catalogs_id', $cat_id)->where('size', $size)->first();
        if (!isset($real_s)) {
            $real_s = new Size;
        }
        return $real_s->price;
    }

    public function today($artist = null)
    {
        if ($artist != null) {
    return $this->id;
 