mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
New translations and routes.
This commit is contained in:
@@ -22,6 +22,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
@@ -29,12 +30,16 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Class Preference.
|
||||
*
|
||||
* @property mixed $data
|
||||
* @property string $name
|
||||
* @property Carbon $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property int $id
|
||||
*/
|
||||
class Preference extends Model
|
||||
{
|
||||
@@ -52,6 +57,25 @@ class Preference extends Model
|
||||
/** @var array */
|
||||
protected $fillable = ['user_id', 'data', 'name'];
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return Account
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Preference
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$preferenceId = (int)$value;
|
||||
$preference = auth()->user()->preferences()->find($preferenceId);
|
||||
if (null !== $preference) {
|
||||
return $preference;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
|
Reference in New Issue
Block a user