mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 04:41:06 +03:30
fix some problems
This commit is contained in:
+21
-5
@@ -3,28 +3,44 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
|
||||
class TestResult extends Model
|
||||
class TestResult extends Model implements HasMedia
|
||||
{
|
||||
use HasMediaTrait;
|
||||
|
||||
public $fillable = ['result','verified','test_type_id','user_id','device_id', 'cycle_number', 'date'];
|
||||
|
||||
public function test_type()
|
||||
{
|
||||
return $this->belongsTo('App\TestType');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function input_values()
|
||||
{
|
||||
return $this->hasMany('App\InputValue');
|
||||
}
|
||||
public function files()
|
||||
|
||||
public function registerMediaCollections()
|
||||
{
|
||||
return $this->morphMany('App\Media', 'model');
|
||||
$this->addMediaCollection( 'main_images' )
|
||||
->useFallbackUrl( '/images/default_pastry.jpg' )
|
||||
->useFallbackPath( public_path( '/images/default_pastry.jpg' ) );
|
||||
}
|
||||
public function TitleImage()
|
||||
|
||||
public function registerMediaConversions( Media $media = null ): void
|
||||
{
|
||||
return $this->morphToMany('App\Gallery', 'uploadable')->wherePivot('image_role', 'TitleImage');
|
||||
$this->addMediaConversion( 'thumbnail' )
|
||||
->width( 480 )
|
||||
->height( 640 )
|
||||
->nonQueued()
|
||||
->performOnCollections( 'main_images' );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user