jonnybarnes.uk/app/Bookmark.php

32 lines
557 B
PHP
Raw Normal View History

2017-10-10 15:58:07 +01:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Bookmark extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['url', 'name', 'content'];
/**
* The tags that belong to the bookmark.
*/
public function tags()
{
return $this->belongsToMany('App\Tag');
}
2017-10-13 13:45:57 +01:00
/**
2017-10-13 19:50:22 +00:00
* The full url of a bookmark.
2017-10-13 13:45:57 +01:00
*/
public function getLongurlAttribute()
{
return config('app.url') . '/bookmarks/' . $this->id;
}
2017-10-10 15:58:07 +01:00
}