Apply fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
857d3004eb
commit
88f3df2180
@@ -22,17 +22,19 @@ use View;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class NotificationController extends Controller {
|
||||
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for sending daily report/notification about the system.
|
||||
* */
|
||||
public function send_notification() {
|
||||
// dd('sdckjdsc');
|
||||
public function send_notification()
|
||||
{
|
||||
// dd('sdckjdsc');
|
||||
//fetching email settings
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
//dd('yes');
|
||||
@@ -61,6 +63,7 @@ class NotificationController extends Controller {
|
||||
//}
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
}
|
||||
|
||||
return $send;
|
||||
}
|
||||
|
||||
@@ -71,24 +74,25 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_admin($company) {
|
||||
public function send_notification_to_admin($company)
|
||||
{
|
||||
// get all admin users
|
||||
$users = User::where('role', '=', 'admin')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to admin
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . ' ' . $user->last_name;
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
$view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]);
|
||||
$contents = $view->render();
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'email' => $email
|
||||
'name' => $user_name,
|
||||
'email' => $email,
|
||||
];
|
||||
$message = [
|
||||
'subject' => 'Daily Report',
|
||||
'subject' => 'Daily Report',
|
||||
'scenario' => null,
|
||||
'body' => $contents
|
||||
'body' => $contents,
|
||||
];
|
||||
|
||||
return $this->PhpMailController->sendEmail($from, $to, $message);
|
||||
@@ -100,7 +104,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_manager($company) {
|
||||
public function send_notification_to_manager($company)
|
||||
{
|
||||
// get all department managers
|
||||
$depts = Department::all();
|
||||
foreach ($depts as $dept) {
|
||||
@@ -110,19 +115,20 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to manager of a department
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . ' ' . $user->last_name;
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
$view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]);
|
||||
$contents = $view->render();
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'email' => $email
|
||||
'name' => $user_name,
|
||||
'email' => $email,
|
||||
];
|
||||
$message = [
|
||||
'subject' => 'Daily Report',
|
||||
'subject' => 'Daily Report',
|
||||
'scenario' => null,
|
||||
'body' => $contents
|
||||
'body' => $contents,
|
||||
];
|
||||
|
||||
return $this->PhpMailController->sendEmail($from, $to, $message);
|
||||
}
|
||||
}
|
||||
@@ -134,7 +140,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_team_lead($company) {
|
||||
public function send_notification_to_team_lead($company)
|
||||
{
|
||||
// get all Team leads
|
||||
$teams = Teams::all();
|
||||
foreach ($teams as $team) {
|
||||
@@ -144,19 +151,20 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to team lead
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . ' ' . $user->last_name;
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id]);
|
||||
$contents = $view->render();
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'email' => $email
|
||||
'name' => $user_name,
|
||||
'email' => $email,
|
||||
];
|
||||
$message = [
|
||||
'subject' => 'Daily Report',
|
||||
'subject' => 'Daily Report',
|
||||
'scenario' => null,
|
||||
'body' => $contents
|
||||
'body' => $contents,
|
||||
];
|
||||
|
||||
return $this->PhpMailController->sendEmail($from, $to, $message);
|
||||
}
|
||||
}
|
||||
@@ -168,26 +176,28 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_agent($company) {
|
||||
public function send_notification_to_agent($company)
|
||||
{
|
||||
// get all agents users
|
||||
$users = User::where('role', '=', 'agent')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to all the agents
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . ' ' . $user->last_name;
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
$view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => $user->id]);
|
||||
$contents = $view->render();
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'email' => $email
|
||||
'name' => $user_name,
|
||||
'email' => $email,
|
||||
];
|
||||
$message = [
|
||||
'subject' => 'Daily Report',
|
||||
'subject' => 'Daily Report',
|
||||
'scenario' => null,
|
||||
'body' => $contents
|
||||
'body' => $contents,
|
||||
];
|
||||
return $this->PhpMailController->sendEmail($from,$to,$message);
|
||||
|
||||
return $this->PhpMailController->sendEmail($from, $to, $message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +206,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return type variable
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
@@ -208,5 +219,4 @@ class NotificationController extends Controller {
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user