mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
New code for email address change in profile. See #857
This commit is contained in:
@@ -16,6 +16,7 @@ namespace FireflyIII\Support;
|
||||
use Cache;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Session;
|
||||
|
||||
/**
|
||||
@@ -25,13 +26,26 @@ use Session;
|
||||
*/
|
||||
class Preferences
|
||||
{
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $search
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function beginsWith(User $user, string $search): Collection
|
||||
{
|
||||
$set = Preference::where('user_id', $user->id)->where('name', 'LIKE', $search . '%')->get();
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete($name): bool
|
||||
public function delete(string $name): bool
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', auth()->user()->id, $name);
|
||||
if (Cache::has($fullName)) {
|
||||
@@ -42,6 +56,18 @@ class Preferences
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function findByName(string $name): Collection
|
||||
{
|
||||
$set = Preference::where('name', $name)->get();
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $default
|
||||
|
Reference in New Issue
Block a user