firefly-iii/app/Models/TransactionCurrency.php

56 lines
1.5 KiB
PHP
Raw Normal View History

2015-02-27 09:48:33 -06:00
<?php namespace FireflyIII\Models;
2016-01-09 09:09:26 -06:00
use Auth;
2016-01-01 14:49:27 -06:00
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
2015-02-27 09:48:33 -06:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
2016-01-09 09:09:26 -06:00
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2015-02-27 09:48:33 -06:00
/**
2016-01-01 14:49:27 -06:00
* FireflyIII\Models\TransactionCurrency
2015-02-27 09:48:33 -06:00
*
2016-01-01 14:49:27 -06:00
* @property integer $id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Carbon $deleted_at
* @property string $code
* @property string $name
* @property string $symbol
* @property-read Collection|TransactionJournal[] $transactionJournals
2015-02-27 09:48:33 -06:00
*/
class TransactionCurrency extends Model
{
use SoftDeletes;
protected $fillable = ['name', 'code', 'symbol'];
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactionJournals()
{
return $this->hasMany('FireflyIII\Models\TransactionJournal');
}
2016-01-09 09:09:26 -06:00
/**
* @param TransactionCurrency $currency
*/
public static function routeBinder(TransactionCurrency $currency)
{
if (Auth::check()) {
return $currency;
}
throw new NotFoundHttpException;
}
2015-02-27 09:48:33 -06:00
}