mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
All code for reminders based on piggy banks. I hope.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Firefly\Storage\Reminder;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class EloquentReminderRepository
|
||||
*
|
||||
* @package Firefly\Storage\Reminder
|
||||
*/
|
||||
class EloquentReminderRepository implements ReminderRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @param \Reminder $reminder
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function deactivate(\Reminder $reminder)
|
||||
{
|
||||
$reminder->active = 0;
|
||||
$reminder->save();
|
||||
|
||||
return $reminder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
return \Reminder::find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$today = new Carbon;
|
||||
|
||||
return \Auth::user()->reminders()->validOn($today)->get();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sander
|
||||
* Date: 23/08/14
|
||||
* Time: 20:59
|
||||
*/
|
||||
|
||||
namespace Firefly\Storage\Reminder;
|
||||
|
||||
|
||||
/**
|
||||
* Interface ReminderRepositoryInterface
|
||||
*
|
||||
* @package Firefly\Storage\Reminder
|
||||
*/
|
||||
interface ReminderRepositoryInterface {
|
||||
|
||||
/**
|
||||
* @param \Reminder $reminder
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function deactivate(\Reminder $reminder);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get();
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function find($id);
|
||||
|
||||
}
|
Reference in New Issue
Block a user