Files
ewaste-backend/app/Models/Listing.php
2025-11-05 14:47:19 -08:00

47 lines
959 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Listing extends Model
{
/** @use HasFactory<\Database\Factories\ListingFactory> */
use HasFactory, SoftDeletes;
/**
* Get the user that made this listing.
*/
public function poster(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'title',
'description',
'price',
'location',
'condition',
'user_id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'user_id',
'deleted_at',
];
}