forked from EckmarCommunity/Eckmar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImage.php
39 lines (32 loc) · 834 Bytes
/
Image.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace App;
use App\Traits\Uuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
class Image extends Model
{
use Uuids;
protected $primaryKey = 'id';
protected $keyType = 'string';
public $incrementing = false;
/**
* Returns the product that holds this image
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function product()
{
return $this -> belongsTo(\App\Product::class, 'product_id', 'id');
}
/**
* Set the product for this images
*
* @param Product $product
*/
public function setProduct(Product $product)
{
$this -> product_id = $product -> id;
}
}