PHP Class Fenos\Notifynder\Notifications\NotificationRepository

Inheritance: implements Fenos\Notifynder\Contracts\NotificationDB, implements Fenos\Notifynder\Contracts\StoreNotification
Show file Open project: fenos/notifynder Class Usage Examples

Protected Properties

Property Type Description
$db Illuminate\Database\DatabaseManager | Illuminate\Database\Connection | Connection
$notification Fenos\Notifynder\Models\Notification | Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder | Builder | BuilderDB

Public Methods

Method Description
__construct ( Notification $notification, Illuminate\Database\DatabaseManager $db )
countNotRead ( $toId, $entity, Closur\Closure $filterScope = null ) : mixed get number Notifications not read.
delete ( $notificationId ) : boolean Delete a notification giving the id of it.
deleteAll ( $toId, $entity ) : boolean Delete All notifications about the current user.
deleteByCategory ( $categoryName, $expired = false ) : boolean Delete All notifications from a defined category.
deleteLimit ( $userId, $entity, $number, $order ) : integer Delete numbers of notifications equals to the number passing as 2 parameter of the current user.
find ( $notificationId ) : Illuminate\Database\Eloquent\Collection | Model | static Find notification by id.
getAll ( $toId, $entity, null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed Retrieve all notifications, not read in first.
getLastNotification ( $toId, $entity, Closur\Closure $filterScope = null ) : mixed Get last notification of the current entity.
getLastNotificationByCategory ( $category, $toId, $entity, Closur\Closure $filterScope = null ) : mixed Get last notification of the current entity of a specific category.
getNotRead ( $toId, $entity, integer | null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed Retrieve notifications not Read You can also limit the number of Notification if you don't it will get all.
getStack ( $stackId, null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed Retrive all notifications, in a stack.
readAll ( $toId, $entity ) : integer Make read all notification not read.
readLimit ( $toId, $entity, $numbers, $order ) : integer Read notifications in base the number Given.
readOne ( Notification $notification ) : boolean | Notification Make Read One Notification.
storeMultiple ( array $notifications ) : mixed Save multiple notifications sent at once.
storeSingle ( array $info ) : Notification Save a single notification sent.

Protected Methods

Method Description
applyFilter ( Closur\Closure $filterScope = null, $query ) Apply scope filters.

Method Details

__construct() public method

public __construct ( Notification $notification, Illuminate\Database\DatabaseManager $db )
$notification Fenos\Notifynder\Models\Notification
$db Illuminate\Database\DatabaseManager

applyFilter() protected method

Apply scope filters.
protected applyFilter ( Closur\Closure $filterScope = null, $query )
$filterScope Closur\Closure
$query

countNotRead() public method

get number Notifications not read.
public countNotRead ( $toId, $entity, Closur\Closure $filterScope = null ) : mixed
$toId
$entity
$filterScope Closur\Closure
return mixed

delete() public method

Delete a notification giving the id of it.
public delete ( $notificationId ) : boolean
$notificationId
return boolean

deleteAll() public method

Delete All notifications about the current user.
public deleteAll ( $toId, $entity ) : boolean
$toId int
$entity
return boolean

deleteByCategory() public method

Delete All notifications from a defined category.
public deleteByCategory ( $categoryName, $expired = false ) : boolean
$categoryName int
$expired Bool
return boolean

deleteLimit() public method

Delete numbers of notifications equals to the number passing as 2 parameter of the current user.
public deleteLimit ( $userId, $entity, $number, $order ) : integer
$userId int
$entity
$number int
$order string
return integer

find() public method

Find notification by id.
public find ( $notificationId ) : Illuminate\Database\Eloquent\Collection | Model | static
$notificationId
return Illuminate\Database\Eloquent\Collection | Illuminate\Database\Eloquent\Model | static

getAll() public method

You can also limit the number of Notifications if you don't, it will get all.
public getAll ( $toId, $entity, null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed
$toId
$entity
$limit null
$paginate integer | null
$orderDate string
$filterScope Closur\Closure
return mixed

getLastNotification() public method

Get last notification of the current entity.
public getLastNotification ( $toId, $entity, Closur\Closure $filterScope = null ) : mixed
$toId
$entity
$filterScope Closur\Closure
return mixed

getLastNotificationByCategory() public method

Get last notification of the current entity of a specific category.
public getLastNotificationByCategory ( $category, $toId, $entity, Closur\Closure $filterScope = null ) : mixed
$category
$toId
$entity
$filterScope Closur\Closure
return mixed

getNotRead() public method

Retrieve notifications not Read You can also limit the number of Notification if you don't it will get all.
public getNotRead ( $toId, $entity, integer | null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed
$toId
$entity
$limit integer | null
$paginate integer | null
$orderDate string
$filterScope Closur\Closure
return mixed

getStack() public method

You can also limit the number of Notifications if you don't, it will get all.
public getStack ( $stackId, null $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed
$stackId
$limit null
$paginate integer | null
$orderDate string
$filterScope Closur\Closure
return mixed

readAll() public method

Make read all notification not read.
public readAll ( $toId, $entity ) : integer
$toId
$entity
return integer

readLimit() public method

Read notifications in base the number Given.
public readLimit ( $toId, $entity, $numbers, $order ) : integer
$toId
$entity
$numbers
$order
return integer

readOne() public method

Make Read One Notification.
public readOne ( Notification $notification ) : boolean | Notification
$notification Fenos\Notifynder\Models\Notification
return boolean | Fenos\Notifynder\Models\Notification

storeMultiple() public method

Save multiple notifications sent at once.
public storeMultiple ( array $notifications ) : mixed
$notifications array
return mixed

storeSingle() public method

Save a single notification sent.
public storeSingle ( array $info ) : Notification
$info array
return Fenos\Notifynder\Models\Notification

Property Details

$db protected property

| Connection
protected DatabaseManager,Illuminate\Database|Connection,Illuminate\Database $db
return Illuminate\Database\DatabaseManager | Illuminate\Database\Connection

$notification protected property

| Builder | BuilderDB
protected Notification,Fenos\Notifynder\Models|Builder,Illuminate\Database\Eloquent|Builder,Illuminate\Database\Query $notification
return Fenos\Notifynder\Models\Notification | Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder