2015-02-27 09:48:33 -06:00
|
|
|
<?php namespace FireflyIII\Models;
|
|
|
|
|
2016-01-09 09:09:26 -06:00
|
|
|
use Auth;
|
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-28 15:06:16 -06:00
|
|
|
* @property integer $id
|
|
|
|
* @property \Carbon\Carbon $created_at
|
|
|
|
* @property \Carbon\Carbon $updated_at
|
|
|
|
* @property \Carbon\Carbon $deleted_at
|
|
|
|
* @property string $code
|
|
|
|
* @property string $name
|
|
|
|
* @property string $symbol
|
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
|
2015-02-27 09:48:33 -06:00
|
|
|
*/
|
|
|
|
class TransactionCurrency extends Model
|
|
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
|
|
|
|
|
|
|
|
protected $fillable = ['name', 'code', 'symbol'];
|
2016-01-15 15:32:21 -06:00
|
|
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
2015-02-27 09:48:33 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2016-01-15 10:38:09 -06:00
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
2016-01-09 09:09:26 -06:00
|
|
|
*/
|
|
|
|
public static function routeBinder(TransactionCurrency $currency)
|
|
|
|
{
|
|
|
|
if (Auth::check()) {
|
|
|
|
return $currency;
|
|
|
|
}
|
|
|
|
throw new NotFoundHttpException;
|
|
|
|
}
|
2015-02-27 09:48:33 -06:00
|
|
|
}
|