Applied fixes from StyleCI

This commit is contained in:
Sujit Prasad
2016-08-05 09:24:12 -04:00
committed by StyleCI Bot
parent 09bf25b5e2
commit e2390f67d4
53 changed files with 1397 additions and 1105 deletions

View File

@@ -2,34 +2,35 @@
namespace App\Http\Controllers\Common;
use App\Http\Controllers\Api\v1\PushNotificationController;
use App\Http\Controllers\Controller;
use App\Model\helpdesk\Notification\Notification;
use App\Model\helpdesk\Notification\NotificationType;
use App\Model\helpdesk\Notification\UserNotification;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use App\Http\Controllers\Api\v1\PushNotificationController;
use App\Model\helpdesk\Notification\NotificationType;
class NotificationController extends Controller {
class NotificationController extends Controller
{
/**
*********************************************
*********************************************
* Class Notification Controller
*********************************************
* This controller is used to generate in app notification
* under the folling occurrence
* under the folling occurrence
* 1. Ticket Creation
* 2. Ticket Reply
* 3. User Creation
*
* 3. User Creation.
*
* @author Ladybird <info@ladybirdweb.com>
*/
public $user;
/**
* Constructor
*/
public function __construct(PushNotificationController $PushNotificationController) {
* Constructor.
*/
public function __construct(PushNotificationController $PushNotificationController)
{
$this->PushNotificationController = $PushNotificationController;
$user = new User();
$this->user = $user;
@@ -41,12 +42,14 @@ class NotificationController extends Controller {
/**
* This function is used to create in app notifications.
*
* @param type $model_id
* @param type $userid_created
* @param type $type_id
* @param type $forwhome
*/
public function create($model_id, $userid_created, $type_id, $forwhome = []) {
public function create($model_id, $userid_created, $type_id, $forwhome = [])
{
try {
if (empty($forwhome)) {
$ticket = Tickets::where('id', '=', $model_id)->first();
@@ -67,48 +70,62 @@ class NotificationController extends Controller {
}
/**
* This function is to mark all ticket to read status
* This function is to mark all ticket to read status.
*
* @param type $id
*
* @return int
*/
public function markAllRead($id) {
public function markAllRead($id)
{
$markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) {
$mark->is_read = '1';
$mark->save();
}
return 1;
}
/**
* This function to mark read
* This function to mark read.
*
* @param type $id
*
* @return int
*/
public function markRead($id) {
public function markRead($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) {
$mark->is_read = '1';
$mark->save();
}
return 1;
}
/**
* function to show all the notifications
* function to show all the notifications.
*
* @return type
*/
public function show() {
public function show()
{
$notifications = $this->getNotifications();
return view('notifications-all', compact('notifications'));
}
/**
* function to delete notifications
* function to delete notifications.
*
* @param type $id
*
* @return int
*/
public function delete($id) {
public function delete($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
foreach ($markasread as $mark) {
$mark->delete();
@@ -119,14 +136,16 @@ class NotificationController extends Controller {
/**
* get the page to list the notifications.
*
* @return response
*/
public static function getNotifications() {
public static function getNotifications()
{
$notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id')
->join('notification_types', 'notifications.type_id', '=', 'notification_types.id')
->where('user_notification.user_id', '=', \Auth::user()->id)
->paginate(10);
return $notifications;
}
}