<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Media extends Model
{
    static function getMediaID($imagename) {
        $getmedia = self::where('file', $imagename)->first();
        if (!empty($getmedia)) {
            $mediaid = $getmedia['id'];
        } else {
            $mediaid = "";
        }
        return $mediaid;
    }

    static function getImage($mediaid) {
        $getmedia = self::where('id', $mediaid)->first();
        if (!empty($getmedia)) {
            $mediaImagePath = "images/media/" . $getmedia['file'];
        } else {
            $mediaImagePath = "";
        }
        return $mediaImagePath;
    }

}
