Files
monica/app/Entry.php
T
Régis Freyd 7e1cd96bf5 Add API (#606)
This is the first part of the API. It supports most of contacts, as well as the
journal. This PR also brings Monica to Laravel 5.5, as the API required it with
the new concept of resources. It needs to run `php artisan migrate` as well as
`php artisan passport:keys` to generate the access tokens needed for the API.
2017-10-30 08:38:15 -04:00

54 lines
855 B
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Entry extends Model
{
protected $table = 'entries';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = ['id'];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'title',
'post',
];
/**
* Get the account record associated with the entry.
*/
public function account()
{
return $this->belongsTo('App\Account');
}
public function getPost()
{
if (is_null($this->post)) {
return;
}
return $this->post;
}
public function getTitle()
{
if (is_null($this->title)) {
return;
}
return $this->title;
}
}