12345678910111213141516171819202122 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Tag extends Model
- {
- const LABEL_KEY = 'name';
- protected $fillable = [self::LABEL_KEY];
- public function getRouteKeyName()
- {
- return static::LABEL_KEY;
- }
- public function posts()
- {
- return $this->belongsToMany(Post::class);
- }
- }
|