Issues (367)

app/Mail/StudentCountExceeded.php (8 issues)

1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\User;
6
use App\Models\Institution_class;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Contracts\Mail\Mailer as MailerContract;
9
use Illuminate\Mail\Mailable;
10
use Illuminate\Queue\SerializesModels;
11
use Illuminate\Contracts\Queue\ShouldQueue;
12
13
class StudentCountExceeded extends Mailable
14
{
15
    use Queueable, SerializesModels;
0 ignored issues
show
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\StudentCountExceeded: $id, $relations, $class, $keyBy
Loading history...
16
17
    /**
18
     * Create a new message instance.
19
     *
20
     * @return void
21
     */
22
    public function __construct($file)
23
    {
24
//        $this->subject = 'SIS Bulk upload: Student count exceeded' . date('Y:m:d H:i:s');
25
//        $this->from = env('MAIL_USERNAME');
26
//        $this->to = [$user->first_name, $user->email];
27
//        $this->viewData = [
28
//            'name'=>$user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit"
29
//        ];
30
31
        $institution = Institution_class::find($file['institution_class_id']);
32
33
        $this->user = User::find($file['security_user_id']);
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
34
        $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '. $institution->name . date('Y:m:d H:i:s');
0 ignored issues
show
The property code does not seem to exist on App\Models\Institution. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
The property name does not seem to exist on App\Models\Institution_class. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
35
        $this->from_address = env('MAIL_FROM_ADDRESS');
0 ignored issues
show
Bug Best Practice introduced by
The property from_address does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
        $this->from_name = 'SIS Bulk Uploader';
0 ignored issues
show
Bug Best Practice introduced by
The property from_name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
37
        $this->with = [
0 ignored issues
show
Bug Best Practice introduced by
The property with does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
38
            'name' => $this->user->first_name,
39
            'link' =>   \App::environment('local') || \App::environment('stage')    ?  env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename']
40
        ];
41
        $this->viewData = [
42
            'name'=>$this->user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit",
43
            'link' =>   \App::environment('local') || \App::environment('stage')    ?  env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename']
44
        ];
45
    }
46
47
    /**
48
     * Build the message.
49
     *
50
     * @return $this
51
     */
52
    public function build()
53
    {
54
        return $this->view('emails.mail')
55
            ->from($this->from_address,$this->from_name)
56
            ->to($this->user->email)
0 ignored issues
show
The property email does not seem to exist on App\Models\User. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
57
            ->subject($this->subject)
58
            ->with($this->with);
59
    }
60
61
}
62