Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class Category extends Model
- {
- use HasFactory;
- /**
- * fillable
- *
- * @var array
- */
- protected $fillable = [
- 'name', 'slug', 'image'
- ];
- /**
- * campaign
- *
- * @return void
- */
- public function campaigns()
- {
- return $this->hasMany(Campaign::class);
- }
- /**
- * getImageAttribute
- *
- * @param mixed $image
- * @return void
- */
- public function getImageAttribute($image)
- {
- return asset('storage/categories/' . $image);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement