Issues (166)

app/Http/Controllers/DashboardController.php (2 issues)

Labels
1
<?php
2
namespace App\Http\Controllers;
3
4
use Illuminate\Http\Request;
5
use JavaScript;
0 ignored issues
show
The type JavaScript was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use DB;
7
use Auth;
8
use Carbon\Carbon;
9
use App\Member;
10
use App\Setting;
11
use App\Invoice;
12
use App\Plan;
13
use App\Expense;
14
use App\Enquiry;
15
use App\Followup;
16
use App\Subscription;
17
use App\Sms_log;
18
use App\Payment_detail;
19
use App\Cheque_detail;
20
use App\Http\Requests;
21
use App\Http\Controllers\Controller;
22
23
class DashboardController extends Controller
24
{
25
	public function __construct()
26
    {
27
        $this->middleware('auth');
28
    }
29
30
    public function index()
31
    {
32
        JavaScript::put([
33
            'jsRegistraionsCount' => \Utilities::registrationsTrend(),
34
            'jsMembersPerPlan' => \Utilities::membersPerPlan(),
35
        ]);
36
37
        $expirings = Subscription::dashboardExpiring()->paginate(5);
38
        $expiringTotal = Subscription::dashboardExpiring()->get();
39
        $expiringCount = $expiringTotal->count();
40
        $allExpired = Subscription::dashboardExpired()->paginate(5);
41
        $allExpiredTotal = Subscription::dashboardExpired()->get();
42
        $expiredCount = $allExpiredTotal->count();
43
        $birthdays = Member::birthday()->get();
44
        $birthdayCount = $birthdays->count();
45
        $recents = Member::recent()->get();
46
        $enquiries = Enquiry::onlyLeads()->get();
47
        $reminders = Followup::reminders()->get();
48
        $reminderCount = $reminders->count();
49
        $dues = Expense::dueAlerts()->get();
50
        $outstandings = Expense::outstandingAlerts()->get();
51
        $smsRequestSetting = \Utilities::getSetting('sms_request');
52
        $smslogs = Sms_log::dashboardLogs()->get();
53
        $recievedCheques = Cheque_detail::where('status',\constChequeStatus::Recieved)->get();
54
        $recievedChequesCount = $recievedCheques->count();
55
        $depositedCheques = Cheque_detail::where('status',\constChequeStatus::Deposited)->get();
56
        $depositedChequesCount = $depositedCheques->count();
57
        $bouncedCheques = Cheque_detail::where('status',\constChequeStatus::Bounced)->get();
58
        $bouncedChequesCount = $bouncedCheques->count();
59
        $membersPerPlan =  json_decode(\Utilities::membersPerPlan());
60
61
		return view('dashboard.index',compact('expirings','allExpired','birthdays','recents','enquiries','reminders','dues','outstandings','smsRequestSetting','smslogs','expiringCount','expiredCount','birthdayCount','reminderCount','recievedCheques','recievedChequesCount','depositedCheques','depositedChequesCount','bouncedCheques','bouncedChequesCount','membersPerPlan'));
62
    }
63
64
    public function smsRequest(Request $request)
65
    {
66
        $contact = 9820461665;
67
        $sms_text = "A request for ".$request->smsCount." sms has came from ".\Utilities::getSetting('gym_name')." by ".Auth::user()->name;
68
        $sms_status = 1;
69
        \Utilities::Sms($contact,$sms_text,$sms_status);
0 ignored issues
show
The call to Utilities::Sms() has too few arguments starting with sms_status. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

69
        \Utilities::/** @scrutinizer ignore-call */ 
70
                    Sms($contact,$sms_text,$sms_status);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
70
71
        Setting::where('key', '=','sms_request')->update(['value' => 1]);
72
73
        flash()->success('Request has been successfully sent, a confirmation call will be made soon');
74
        return redirect('/dashboard');
75
    }
76
77
}
78