Apply fixes from StyleCI

This commit is contained in:
FreeScout
2018-07-24 06:34:28 +00:00
committed by StyleCI Bot
parent 371a9d523f
commit f5b82add66
80 changed files with 1102 additions and 1075 deletions

View File

@@ -15,7 +15,7 @@ class ActivityLog extends Activity
const DESCRIPTION_USER_LOGIN_FAILED = 'login_failed';
const DESCRIPTION_USER_PASSWORD_RESET = 'password_reset';
function getEventDescription()
public function getEventDescription()
{
switch ($this->description) {
case self::DESCRIPTION_USER_LOGIN:

View File

@@ -2,8 +2,8 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\User;
use Illuminate\Console\Command;
class CreateUser extends Command
{
@@ -39,46 +39,47 @@ class CreateUser extends Command
public function handle()
{
$class = config(
'auth.providers.' . config(
'auth.guards.' . config(
'auth.providers.'.config(
'auth.guards.'.config(
'auth.defaults.guard'
) . '.provider'
) . '.model'
).'.provider'
).'.model'
);
$user = new $class;
$user = new $class();
$fillables = ['role', 'first_name', 'last_name', 'email', 'password'];
foreach($fillables as $key => $fillable) {
foreach ($fillables as $key => $fillable) {
if ($fillable == 'password') {
$user->password = \Hash::make($this->secret(($key+1) . "/" . count($fillables) . " User $fillable"));
$user->password = \Hash::make($this->secret(($key + 1).'/'.count($fillables)." User $fillable"));
} elseif ($fillable == 'role') {
$user->$fillable = $this->ask(($key+1) . "/" . count($fillables) . " User $fillable (admin/user)", 'admin');
$user->$fillable = $this->ask(($key + 1).'/'.count($fillables)." User $fillable (admin/user)", 'admin');
if (!$user->$fillable) {
$user->$fillable = 'admin';
}
while (!in_array($user->$fillable, User::$roles)) {
$this->error("Incorrect role");
$user->$fillable = $this->ask("Please enter valid role");
$this->error('Incorrect role');
$user->$fillable = $this->ask('Please enter valid role');
}
$user->$fillable = array_flip(User::$roles)[$user->$fillable];
} else {
$user->$fillable = $this->ask(($key+1) . "/" . count($fillables) . " User $fillable");
$user->$fillable = $this->ask(($key + 1).'/'.count($fillables)." User $fillable");
if ($fillable == 'email') {
while (!filter_var($user->$fillable, FILTER_VALIDATE_EMAIL)) {
$this->error("Incorrect email address");
$user->$fillable = $this->ask("Please enter valid email address");
$this->error('Incorrect email address');
$user->$fillable = $this->ask('Please enter valid email address');
}
}
}
}
if ($this->confirm("Do you want to create the user?", true)) {
if ($this->confirm('Do you want to create the user?', true)) {
if ($user->isAdmin()) {
$user->invite_state = User::INVITE_STATE_ACTIVATED;
}
$user->save();
$this->info("User created (id: {$user->id})");
}
return true;
}
}

View File

@@ -20,6 +20,7 @@ class Kernel extends ConsoleKernel
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)

View File

@@ -7,36 +7,36 @@ use Illuminate\Database\Eloquent\Model;
class Conversation extends Model
{
/**
* By whom action performed (used in fields: source_via, last_reply_from)
* By whom action performed (used in fields: source_via, last_reply_from).
*/
const PERSON_CUSTOMER = 1;
const PERSON_USER = 2;
public static $persons = array(
public static $persons = [
self::PERSON_CUSTOMER => 'customer',
self::PERSON_USER => 'user',
);
];
/**
* Max length of the preview
* Max length of the preview.
*/
const PREVIEW_MAXLENGTH = 255;
/**
* Conversation types
* Conversation types.
*/
const TYPE_EMAIL = 1;
const TYPE_PHONE = 2;
const TYPE_CHAT = 3; // not used
public static $types = array(
public static $types = [
self::TYPE_EMAIL => 'email',
self::TYPE_PHONE => 'phone',
self::TYPE_CHAT => 'chat',
);
];
/**
* Conversation statuses
* Conversation statuses.
*/
const STATUS_ACTIVE = 1;
const STATUS_PENDING = 2;
@@ -45,58 +45,58 @@ class Conversation extends Model
// Present in the API, but what does it mean?
const STATUS_OPEN = 5;
public static $statuses = array(
public static $statuses = [
self::STATUS_ACTIVE => 'active',
self::STATUS_PENDING => 'pending',
self::STATUS_CLOSED => 'closed',
self::STATUS_SPAM => 'spam',
//self::STATUS_OPEN => 'open',
);
];
/**
* https://glyphicons.bootstrapcheatsheets.com/
* https://glyphicons.bootstrapcheatsheets.com/.
*/
public static $status_icons = array(
public static $status_icons = [
self::STATUS_ACTIVE => 'ok',
self::STATUS_PENDING => 'hourglass',
self::STATUS_CLOSED => 'lock',
self::STATUS_SPAM => 'ban-circle',
//self::STATUS_OPEN => 'folder-open',
);
];
public static $status_colors = array(
public static $status_colors = [
self::STATUS_ACTIVE => 'success',
self::STATUS_PENDING => 'warning',
self::STATUS_CLOSED => 'grey',
self::STATUS_SPAM => 'danger',
//self::STATUS_OPEN => 'folder-open',
);
];
/**
* Conversation states
* Conversation states.
*/
const STATE_DRAFT = 1;
const STATE_PUBLISHED = 2;
const STATE_DELETED = 3;
public static $states = array(
public static $states = [
self::STATE_DRAFT => 'draft',
self::STATE_PUBLISHED => 'published',
self::STATE_DELETED => 'deleted',
);
];
/**
* Source types (equal to thread source types)
* Source types (equal to thread source types).
*/
const SOURCE_TYPE_EMAIL = 1;
const SOURCE_TYPE_WEB = 2;
const SOURCE_TYPE_API = 3;
public static $source_types = array(
public static $source_types = [
self::SOURCE_TYPE_EMAIL => 'email',
self::SOURCE_TYPE_WEB => 'web',
self::SOURCE_TYPE_API => 'api',
);
];
/**
* Automatically converted into Carbon dates.
@@ -104,7 +104,7 @@ class Conversation extends Model
protected $dates = ['created_at', 'updated_at', 'last_reply_at'];
/**
* Attributes which are not fillable using fill() method
* Attributes which are not fillable using fill() method.
*/
protected $guarded = ['id', 'folder_id'];
@@ -112,14 +112,13 @@ class Conversation extends Model
{
parent::boot();
self::creating(function (Conversation $model)
{
$model->number = Conversation::where('mailbox_id', $model->mailbox_id)->max('number')+1;
self::creating(function (Conversation $model) {
$model->number = Conversation::where('mailbox_id', $model->mailbox_id)->max('number') + 1;
});
}
/**
* Who the conversation is assigned to (assignee)
* Who the conversation is assigned to (assignee).
*/
public function user()
{
@@ -127,7 +126,7 @@ class Conversation extends Model
}
/**
* Get the folder to which conversation belongs
* Get the folder to which conversation belongs.
*/
public function folder()
{
@@ -135,7 +134,7 @@ class Conversation extends Model
}
/**
* Get the mailbox to which conversation belongs
* Get the mailbox to which conversation belongs.
*/
public function mailbox()
{
@@ -143,7 +142,7 @@ class Conversation extends Model
}
/**
* Get the customer associated with this conversation (primaryCustomer)
* Get the customer associated with this conversation (primaryCustomer).
*/
public function customer()
{
@@ -151,7 +150,7 @@ class Conversation extends Model
}
/**
* Get conversation threads
* Get conversation threads.
*/
public function threads()
{
@@ -159,7 +158,7 @@ class Conversation extends Model
}
/**
* Folders containing starred conversations
* Folders containing starred conversations.
*/
public function extraFolders()
{
@@ -167,7 +166,7 @@ class Conversation extends Model
}
/**
* Set preview text
* Set preview text.
*
* @param string $text
*/
@@ -183,6 +182,7 @@ class Conversation extends Model
$this->preview = mb_substr($first_thread->body, 0, self::PREVIEW_MAXLENGTH);
}
}
return $this->preview;
}
@@ -194,11 +194,12 @@ class Conversation extends Model
public function getDateTitle()
{
if ($this->threads_count == 1) {
$title = __("Created by :person<br/>:date", ['person' => ucfirst(__(
$title = __('Created by :person<br/>:date', ['person' => ucfirst(__(
self::$persons[$this->source_via])), 'date' => User::dateFormat($this->created_at, 'M j, Y H:i')]);
} else {
$title = __("Last reply by :person<br/>:date", ['person' => ucfirst(__(self::$persons[$this->source_via])), 'date' => User::dateFormat($this->created_at, 'M j, Y H:i')]);
$title = __('Last reply by :person<br/>:date', ['person' => ucfirst(__(self::$persons[$this->source_via])), 'date' => User::dateFormat($this->created_at, 'M j, Y H:i')]);
}
return $title;
}
@@ -210,30 +211,31 @@ class Conversation extends Model
/**
* Get status name.
*
* @param integer $status
* @param int $status
*
* @return string
*/
public static function getStatusName($status)
{
switch ($status) {
case self::STATUS_ACTIVE:
return __("Active");
return __('Active');
break;
case self::STATUS_PENDING:
return __("Pending");
return __('Pending');
break;
case self::STATUS_CLOSED:
return __("Closed");
return __('Closed');
break;
case self::STATUS_SPAM:
return __("Spam");
return __('Spam');
break;
case self::STATUS_OPEN:
return __("Open");
return __('Open');
break;
default:

View File

@@ -3,19 +3,18 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Email;
class Customer extends Model
{
/**
* Genders
* Genders.
*/
const GENDER_UNKNOWN = 1;
const GENDER_MALE = 2;
const GENDER_FEMALE = 3;
/**
* For API
* For API.
*/
public static $genders = [
self::GENDER_UNKNOWN => 'unknown',
@@ -24,7 +23,7 @@ class Customer extends Model
];
/**
* Phone types
* Phone types.
*/
const PHONE_TYPE_WORK = 1;
const PHONE_TYPE_HOME = 2;
@@ -34,7 +33,7 @@ class Customer extends Model
const PHONE_TYPE_PAGER = 6;
/**
* For API
* For API.
*/
public static $phone_types = [
self::PHONE_TYPE_WORK => 'work',
@@ -46,7 +45,7 @@ class Customer extends Model
];
/**
* Photo types
* Photo types.
*/
const PHOTO_TYPE_UKNOWN = 1;
const PHOTO_TYPE_GRAVATAR = 2;
@@ -58,7 +57,7 @@ class Customer extends Model
const PHOTO_TYPE_VK = 8; // Extra
/**
* For API
* For API.
*/
public static $photo_types = [
self::PHOTO_TYPE_UKNOWN => 'unknown',
@@ -72,7 +71,7 @@ class Customer extends Model
];
/**
* Chat types
* Chat types.
*/
const CHAT_TYPE_AIM = 1;
const CHAT_TYPE_GTALK = 2;
@@ -86,7 +85,7 @@ class Customer extends Model
const CHAT_TYPE_OTHER = 9;
/**
* For API
* For API.
*/
public static $chat_types = [
self::CHAT_TYPE_AIM => 'aim',
@@ -115,7 +114,7 @@ class Customer extends Model
];
/**
* Social types
* Social types.
*/
const SOCIAL_TYPE_TWITTER = 1;
const SOCIAL_TYPE_FACEBOOK = 2;
@@ -164,274 +163,275 @@ class Customer extends Model
];
/**
* Countries list
* Countries list.
*/
public static $countries = [
"US" => "United States",
"AU" => "Australia",
"CA" => "Canada",
"DK" => "Denmark",
"FR" => "France",
"DE" => "Germany",
"IT" => "Italy",
"JP" => "Japan",
"MX" => "Mexico",
"ES" => "Spain",
"SE" => "Sweden",
"GB" => "United Kingdom",
"AF" => "Afghanistan",
"AX" => "Åland Islands",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
"AI" => "Anguilla",
"AQ" => "Antarctica",
"AG" => "Antigua and Barbuda",
"AR" => "Argentina",
"AM" => "Armenia",
"AW" => "Aruba",
"AT" => "Austria",
"AZ" => "Azerbaijan",
"BS" => "Bahamas",
"BH" => "Bahrain",
"BD" => "Bangladesh",
"BB" => "Barbados",
"BY" => "Belarus",
"BE" => "Belgium",
"BZ" => "Belize",
"BJ" => "Benin",
"BM" => "Bermuda",
"BT" => "Bhutan",
"BO" => "Bolivia",
"BQ" => "Bonaire",
"BA" => "Bosnia and Herzegowina",
"BW" => "Botswana",
"BV" => "Bouvet Island",
"BR" => "Brazil",
"IO" => "British Indian Ocean Territory",
"BN" => "Brunei Darussalam",
"BG" => "Bulgaria",
"BF" => "Burkina Faso",
"BI" => "Burundi",
"KH" => "Cambodia",
"CM" => "Cameroon",
"CV" => "Cape Verde",
"KY" => "Cayman Islands",
"CF" => "Central African Republic",
"TD" => "Chad",
"CL" => "Chile",
"CN" => "China",
"CX" => "Christmas Island",
"CC" => "Cocos (Keeling) Islands",
"CO" => "Colombia",
"KM" => "Comoros",
"CG" => "Congo",
"CD" => "Congo, DR",
"CK" => "Cook Islands",
"CR" => "Costa Rica",
"CI" => "Cote D'Ivoire",
"HR" => "Croatia",
"CU" => "Cuba",
"CW" => "Curacao",
"CY" => "Cyprus",
"CZ" => "Czech Republic",
"DJ" => "Djibouti",
"DM" => "Dominica",
"DO" => "Dominican Republic",
"EC" => "Ecuador",
"EG" => "Egypt",
"SV" => "El Salvador",
"GQ" => "Equatorial Guinea",
"ER" => "Eritrea",
"EE" => "Estonia",
"ET" => "Ethiopia",
"FK" => "Falkland Islands (Malvinas)",
"FO" => "Faroe Islands",
"FJ" => "Fiji",
"FI" => "Finland",
"GF" => "French Guiana",
"PF" => "French Polynesia",
"TF" => "French Southern Territories",
"GA" => "Gabon",
"GM" => "Gambia",
"GE" => "Georgia",
"GH" => "Ghana",
"GI" => "Gibraltar",
"GR" => "Greece",
"GL" => "Greenland",
"GD" => "Grenada",
"GP" => "Guadeloupe",
"GU" => "Guam",
"GT" => "Guatemala",
"GG" => "Guernsey",
"GN" => "Guinea",
"GW" => "Guinea-bissau",
"GY" => "Guyana",
"HT" => "Haiti",
"HM" => "Heard and Mc Donald Islands",
"HN" => "Honduras",
"HK" => "Hong Kong",
"HU" => "Hungary",
"IS" => "Iceland",
"IN" => "India",
"ID" => "Indonesia",
"IR" => "Iran (Islamic Republic of)",
"IQ" => "Iraq",
"IE" => "Ireland",
"IM" => "Isle of Man",
"IL" => "Israel",
"JM" => "Jamaica",
"JE" => "Jersey",
"JO" => "Jordan",
"KZ" => "Kazakhstan",
"KE" => "Kenya",
"KI" => "Kiribati",
"KP" => "Korea, Democratic People's Republic of",
"KR" => "Korea, Republic of",
"KW" => "Kuwait",
"KG" => "Kyrgyzstan",
"LA" => "Lao People's Democratic Republic",
"LV" => "Latvia",
"LB" => "Lebanon",
"LS" => "Lesotho",
"LR" => "Liberia",
"LY" => "Libya",
"LI" => "Liechtenstein",
"LT" => "Lithuania",
"LU" => "Luxembourg",
"MO" => "Macao",
"MK" => "Macedonia, The Former Yugoslav Republic of",
"MG" => "Madagascar",
"MW" => "Malawi",
"MY" => "Malaysia",
"MV" => "Maldives",
"ML" => "Mali",
"MT" => "Malta",
"MH" => "Marshall Islands",
"MQ" => "Martinique",
"MR" => "Mauritania",
"MU" => "Mauritius",
"YT" => "Mayotte",
"FM" => "Micronesia, Federated States of",
"MD" => "Moldova, Republic of",
"MC" => "Monaco",
"MN" => "Mongolia",
"ME" => "Montenegro",
"MS" => "Montserrat",
"MA" => "Morocco",
"MZ" => "Mozambique",
"MM" => "Myanmar",
"NA" => "Namibia",
"NR" => "Nauru",
"NP" => "Nepal",
"NL" => "Netherlands",
"NC" => "New Caledonia",
"NZ" => "New Zealand",
"NI" => "Nicaragua",
"NE" => "Niger",
"NG" => "Nigeria",
"NU" => "Niue",
"00" => "None Available",
"NF" => "Norfolk Island",
"MP" => "Northern Mariana Islands",
"NO" => "Norway",
"OM" => "Oman",
"PK" => "Pakistan",
"PW" => "Palau",
"PS" => "Palestine, State of",
"PA" => "Panama",
"PG" => "Papua New Guinea",
"PY" => "Paraguay",
"PE" => "Peru",
"PH" => "Philippines",
"PN" => "Pitcairn",
"PL" => "Poland",
"PT" => "Portugal",
"PR" => "Puerto Rico",
"QA" => "Qatar",
"RE" => "Reunion",
"RO" => "Romania",
"RU" => "Russia",
"RW" => "Rwanda",
"BL" => "Saint Barthelemy",
"KN" => "Saint Kitts and Nevis",
"LC" => "Saint Lucia",
"MF" => "Saint Martin (French part)",
"VC" => "Saint Vincent and the Grenadines",
"WS" => "Samoa",
"SM" => "San Marino",
"ST" => "Sao Tome and Principe",
"SA" => "Saudi Arabia",
"SN" => "Senegal",
"RS" => "Serbia",
"SC" => "Seychelles",
"SL" => "Sierra Leone",
"SG" => "Singapore",
"SX" => "Sint Maarten (Dutch part)",
"SK" => "Slovakia",
"SI" => "Slovenia",
"SB" => "Solomon Islands",
"SO" => "Somalia",
"ZA" => "South Africa",
"GS" => "South Georgia and the South Sandwich Islands",
"SS" => "South Sudan",
"LK" => "Sri Lanka",
"SH" => "St. Helena",
"PM" => "St. Pierre and Miquelon",
"SD" => "Sudan",
"SR" => "Suriname",
"SJ" => "Svalbard and Jan Mayen",
"SZ" => "Swaziland",
"CH" => "Switzerland",
"SY" => "Syrian Arab Republic",
"TW" => "Taiwan, Province of China",
"TJ" => "Tajikistan",
"TZ" => "Tanzania, United Republic of",
"TH" => "Thailand",
"TL" => "Timor-Leste",
"TG" => "Togo",
"TK" => "Tokelau",
"TO" => "Tonga",
"TT" => "Trinidad and Tobago",
"TN" => "Tunisia",
"TR" => "Turkey",
"TM" => "Turkmenistan",
"TC" => "Turks and Caicos Islands",
"TV" => "Tuvalu",
"UG" => "Uganda",
"UA" => "Ukraine",
"AE" => "United Arab Emirates",
"UM" => "United States Minor Outlying Islands",
"UY" => "Uruguay",
"UZ" => "Uzbekistan",
"VU" => "Vanuatu",
"VA" => "Vatican City State (Holy See)",
"VE" => "Venezuela",
"VN" => "Vietnam",
"VG" => "Virgin Islands (British)",
"VI" => "Virgin Islands (U.S.)",
"WF" => "Wallis and Futuna Islands",
"EH" => "Western Sahara",
"YE" => "Yemen",
"ZM" => "Zambia",
"ZW" => "Zimbabwe",
'US' => 'United States',
'AU' => 'Australia',
'CA' => 'Canada',
'DK' => 'Denmark',
'FR' => 'France',
'DE' => 'Germany',
'IT' => 'Italy',
'JP' => 'Japan',
'MX' => 'Mexico',
'ES' => 'Spain',
'SE' => 'Sweden',
'GB' => 'United Kingdom',
'AF' => 'Afghanistan',
'AX' => 'Åland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua and Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BQ' => 'Bonaire',
'BA' => 'Bosnia and Herzegowina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China',
'CX' => 'Christmas Island',
'CC' => 'Cocos (Keeling) Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo',
'CD' => 'Congo, DR',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => "Cote D'Ivoire",
'HR' => 'Croatia',
'CU' => 'Cuba',
'CW' => 'Curacao',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands (Malvinas)',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'TF' => 'French Southern Territories',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GG' => 'Guernsey',
'GN' => 'Guinea',
'GW' => 'Guinea-bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HM' => 'Heard and Mc Donald Islands',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran (Islamic Republic of)',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IM' => 'Isle of Man',
'IL' => 'Israel',
'JM' => 'Jamaica',
'JE' => 'Jersey',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KP' => "Korea, Democratic People's Republic of",
'KR' => 'Korea, Republic of',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => "Lao People's Democratic Republic",
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macao',
'MK' => 'Macedonia, The Former Yugoslav Republic of',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte',
'FM' => 'Micronesia, Federated States of',
'MD' => 'Moldova, Republic of',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'ME' => 'Montenegro',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'MM' => 'Myanmar',
'NA' => 'Namibia',
'NR' => 'Nauru',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NU' => 'Niue',
'00' => 'None Available',
'NF' => 'Norfolk Island',
'MP' => 'Northern Mariana Islands',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau',
'PS' => 'Palestine, State of',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico',
'QA' => 'Qatar',
'RE' => 'Reunion',
'RO' => 'Romania',
'RU' => 'Russia',
'RW' => 'Rwanda',
'BL' => 'Saint Barthelemy',
'KN' => 'Saint Kitts and Nevis',
'LC' => 'Saint Lucia',
'MF' => 'Saint Martin (French part)',
'VC' => 'Saint Vincent and the Grenadines',
'WS' => 'Samoa',
'SM' => 'San Marino',
'ST' => 'Sao Tome and Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'RS' => 'Serbia',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SX' => 'Sint Maarten (Dutch part)',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia and the South Sandwich Islands',
'SS' => 'South Sudan',
'LK' => 'Sri Lanka',
'SH' => 'St. Helena',
'PM' => 'St. Pierre and Miquelon',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SJ' => 'Svalbard and Jan Mayen',
'SZ' => 'Swaziland',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan, Province of China',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania, United Republic of',
'TH' => 'Thailand',
'TL' => 'Timor-Leste',
'TG' => 'Togo',
'TK' => 'Tokelau',
'TO' => 'Tonga',
'TT' => 'Trinidad and Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks and Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'UM' => 'United States Minor Outlying Islands',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VA' => 'Vatican City State (Holy See)',
'VE' => 'Venezuela',
'VN' => 'Vietnam',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (U.S.)',
'WF' => 'Wallis and Futuna Islands',
'EH' => 'Western Sahara',
'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
];
/**
* Attributes which are not fillable using fill() method
* Attributes which are not fillable using fill() method.
*/
protected $guarded = ['id'];
/**
* Attributes fillable using fill() method
* Attributes fillable using fill() method.
*
* @var [type]
*/
protected $fillable = ['first_name', 'last_name', 'company', 'job_title', 'address', 'city', 'state', 'zip', 'country'];
/**
* Get customer emails
* Get customer emails.
*/
public function emails()
{
@@ -439,7 +439,7 @@ class Customer extends Model
}
/**
* Get customer conversations
* Get customer conversations.
*/
public function conversations()
{
@@ -447,7 +447,7 @@ class Customer extends Model
}
/**
* Get main email
* Get main email.
*/
public function getMainEmail()
{
@@ -462,7 +462,7 @@ class Customer extends Model
public function getFullName()
{
if ($this->first_name || $this->last_name) {
return $this->first_name . ' ' . $this->last_name;
return $this->first_name.' '.$this->last_name;
} elseif ($this->emails) {
return explode('@', $this->emails[0]->email)[0];
} else {
@@ -471,7 +471,8 @@ class Customer extends Model
}
/**
* Set customer emails
* Set customer emails.
*
* @param array $emails
*/
public function syncEmails($emails)
@@ -508,7 +509,7 @@ class Customer extends Model
}
// Create customers for deleted emails
foreach ($deleted_emails as $email) {
$customer = new Customer();
$customer = new self();
$customer->save();
$email->customer()->associate($customer);
$email->save();
@@ -541,9 +542,10 @@ class Customer extends Model
}
/**
* Sanitize phones array
* Sanitize phones array.
*
* @param array $phones_array [description]
*
* @return array [description]
*/
public static function formatPhones(array $phones_array)
@@ -552,11 +554,12 @@ class Customer extends Model
foreach ($phones_array as $phone) {
if (!empty($phone['value']) && !empty($phone['type']) && in_array($phone['type'], array_keys(self::$phone_types))) {
$phones[] = [
'value' => (string)$phone['value'],
'type' => (int)$phone['type'],
'value' => (string) $phone['value'],
'type' => (int) $phone['type'],
];
}
}
return json_encode($phones);
}
@@ -591,18 +594,19 @@ class Customer extends Model
}
/**
* Set websites as JSON
* Set websites as JSON.
*
* @param array $websites_array
*/
public function setWebsites(array $websites_array)
{
$websites = [];
foreach ($websites_array as $key => $value) {
$value = filter_var((string)$value, FILTER_SANITIZE_URL);
$value = filter_var((string) $value, FILTER_SANITIZE_URL);
if (!preg_match("/http(s)?:\/\//i", $value)) {
$value = 'http://'.$value;
}
$websites[] = (string)$value;
$websites[] = (string) $value;
}
$this->websites = json_encode($websites);
}

View File

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class Email extends Model
{
/**
* Email types
* Email types.
*/
const TYPE_WORK = 'work';
const TYPE_HOME = 'home';
@@ -16,12 +16,12 @@ class Email extends Model
public $timestamps = false;
/**
* Attributes which are not fillable using fill() method
* Attributes which are not fillable using fill() method.
*/
protected $guarded = ['id', 'customer_id'];
/**
* Get email's customer
* Get email's customer.
*/
public function customer()
{
@@ -29,8 +29,10 @@ class Email extends Model
}
/**
* Sanatize email address
* Sanatize email address.
*
* @param string $email
*
* @return string
*/
public static function sanatizeEmail($email)

View File

@@ -3,12 +3,10 @@
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class Event
{

View File

@@ -32,6 +32,7 @@ class Handler extends ExceptionHandler
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
*
* @return void
*/
public function report(Exception $exception)
@@ -44,6 +45,7 @@ class Handler extends ExceptionHandler
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)

View File

@@ -3,12 +3,11 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\MailboxUser;
class Folder extends Model
{
/**
* Folders types (ids from HelpScout interface)
* Folders types (ids from HelpScout interface).
*/
const TYPE_UNASSIGNED = 1;
// User specific
@@ -33,7 +32,7 @@ class Folder extends Model
];
/**
* https://glyphicons.bootstrapcheatsheets.com/
* https://glyphicons.bootstrapcheatsheets.com/.
*/
public static $type_icons = [
self::TYPE_UNASSIGNED => 'folder-open',
@@ -65,7 +64,7 @@ class Folder extends Model
public $timestamps = false;
/**
* Get the mailbox to which folder belongs
* Get the mailbox to which folder belongs.
*/
public function mailbox()
{
@@ -73,7 +72,7 @@ class Folder extends Model
}
/**
* Get the user to which folder belongs
* Get the user to which folder belongs.
*/
public function user()
{
@@ -81,7 +80,7 @@ class Folder extends Model
}
/**
* Get starred conversations
* Get starred conversations.
*/
public function conversations()
{

View File

@@ -2,10 +2,10 @@
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
@@ -43,6 +43,7 @@ class RegisterController extends Controller
* Get a validator for an incoming registration request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
@@ -59,6 +60,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration.
*
* @param array $data
*
* @return \App\User
*/
protected function create(array $data)
@@ -72,7 +74,7 @@ class RegisterController extends Controller
}
/**
* Registration is disabled
* Registration is disabled.
*/
public function showRegistrationForm()
{
@@ -81,6 +83,5 @@ class RegisterController extends Controller
public function register()
{
}
}

View File

@@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{

View File

@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
use App\Conversation;
class ConversationsController extends Controller
@@ -33,7 +31,7 @@ class ConversationsController extends Controller
'customer' => $conversation->customer,
'threads' => $conversation->threads,
'folder' => $conversation->folder,
'folders' => $conversation->mailbox->getAssesibleFolders()
'folders' => $conversation->mailbox->getAssesibleFolders(),
]);
}
}

View File

@@ -2,11 +2,9 @@
namespace App\Http\Controllers;
use App\Customer;
use Illuminate\Http\Request;
use Validator;
use Illuminate\Validation\Rule;
use App\Customer;
use App\Email;
class CustomersController extends Controller
{
@@ -21,7 +19,7 @@ class CustomersController extends Controller
}
/**
* Edit customer
* Edit customer.
*/
public function update($id)
{
@@ -43,6 +41,7 @@ class CustomersController extends Controller
* Save customer.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function updateSave($id, Request $request)
@@ -74,11 +73,12 @@ class CustomersController extends Controller
$customer->syncEmails($request->emails);
\Session::flash('flash_success', __('Customer saved successfully'));
return redirect()->route('customers.update', ['id' => $id]);
}
/**
* User mailboxes
* User mailboxes.
*/
public function permissions($id)
{
@@ -91,7 +91,7 @@ class CustomersController extends Controller
}
/**
* Save user permissions
* Save user permissions.
*
* @param int $id
* @param \Illuminate\Http\Request $request
@@ -104,6 +104,7 @@ class CustomersController extends Controller
$user->mailboxes()->sync($request->mailboxes);
\Session::flash('flash_success', __('Permissions saved successfully'));
return redirect()->route('users.permissions', ['id' => $id]);
}

View File

@@ -2,12 +2,12 @@
namespace App\Http\Controllers;
use App\Folder;
use App\Mailbox;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Validator;
use App\Mailbox;
use App\User;
use App\Folder;
class MailboxesController extends Controller
{
@@ -22,7 +22,7 @@ class MailboxesController extends Controller
}
/**
* Mailboxes list
* Mailboxes list.
*/
public function mailboxes()
{
@@ -32,7 +32,7 @@ class MailboxesController extends Controller
}
/**
* New mailbox
* New mailbox.
*/
public function create()
{
@@ -44,7 +44,7 @@ class MailboxesController extends Controller
}
/**
* Create new mailbox
* Create new mailbox.
*
* @param \Illuminate\Http\Request $request
*/
@@ -65,7 +65,7 @@ class MailboxesController extends Controller
->withInput();
}
$mailbox = new Mailbox;
$mailbox = new Mailbox();
$mailbox->fill($request->all());
$mailbox->save();
@@ -73,11 +73,12 @@ class MailboxesController extends Controller
$mailbox->syncPersonalFolders($request->users);
\Session::flash('flash_success', __('Mailbox created successfully'));
return redirect()->route('mailboxes.update', ['id' => $mailbox->id]);
}
/**
* Edit mailbox
* Edit mailbox.
*/
public function update($id)
{
@@ -90,7 +91,7 @@ class MailboxesController extends Controller
}
/**
* Save mailbox
* Save mailbox.
*
* @param int $id
* @param \Illuminate\Http\Request $request
@@ -126,11 +127,12 @@ class MailboxesController extends Controller
$mailbox->save();
\Session::flash('flash_success', __('Mailbox settings saved'));
return redirect()->route('mailboxes.update', ['id' => $id]);
}
/**
* Mailbox permissions
* Mailbox permissions.
*/
public function permissions($id)
{
@@ -144,7 +146,7 @@ class MailboxesController extends Controller
}
/**
* Save mailbox permissions
* Save mailbox permissions.
*
* @param int $id
* @param \Illuminate\Http\Request $request
@@ -158,11 +160,12 @@ class MailboxesController extends Controller
$mailbox->syncPersonalFolders($request->users);
\Session::flash('flash_success', __('Mailbox permissions saved!'));
return redirect()->route('mailboxes.permissions', ['id' => $id]);
}
/**
* Mailbox connection settings
* Mailbox connection settings.
*/
public function connectionOutgoing($id)
{
@@ -173,7 +176,7 @@ class MailboxesController extends Controller
}
/**
* Save mailbox connection settings
* Save mailbox connection settings.
*/
public function connectionOutgoingSave($id, Request $request)
{
@@ -200,11 +203,12 @@ class MailboxesController extends Controller
$mailbox->save();
\Session::flash('flash_success', __('Connection settings saved!'));
return redirect()->route('mailboxes.connection', ['id' => $id]);
}
/**
* Mailbox incoming settings
* Mailbox incoming settings.
*/
public function connectionIncoming($id)
{
@@ -215,7 +219,7 @@ class MailboxesController extends Controller
}
/**
* Save mailbox connection settings
* Save mailbox connection settings.
*/
public function connectionIncomingSave($id, Request $request)
{
@@ -239,11 +243,12 @@ class MailboxesController extends Controller
$mailbox->save();
\Session::flash('flash_success', __('Connection settings saved!'));
return redirect()->route('mailboxes.connection.incoming', ['id' => $id]);
}
/**
* View mailbox
* View mailbox.
*/
public function view($id, $folder_id = null)
{
@@ -253,13 +258,13 @@ class MailboxesController extends Controller
$folder = null;
if (!empty($folder_id)) {
$folder = $folders->filter(function($item) use ($folder_id) {
$folder = $folders->filter(function ($item) use ($folder_id) {
return $item->id == $folder_id;
})->first();
}
// By default we display Unassigned folder
if (empty($folder)) {
$folder = $folders->filter(function($item) {
$folder = $folders->filter(function ($item) {
return $item->type == Folder::TYPE_UNASSIGNED;
})->first();
}
@@ -282,15 +287,15 @@ class MailboxesController extends Controller
if (Route::currentRouteName() != 'mailboxes.connection' && !$mailbox->isOutActive()) {
$flashes[] = [
'type' => 'warning',
'text' => __('Sending emails need to be configured for the mailbox in order to send emails to customers and support agents').' (<a href="'.route('mailboxes.connection', ['id' => $mailbox->id]).'">'.__("Connection Settings » Sending Emails").'</a>)',
'unescaped' => true
'text' => __('Sending emails need to be configured for the mailbox in order to send emails to customers and support agents').' (<a href="'.route('mailboxes.connection', ['id' => $mailbox->id]).'">'.__('Connection Settings » Sending Emails').'</a>)',
'unescaped' => true,
];
}
if (Route::currentRouteName() != 'mailboxes.connection.incoming' && !$mailbox->isInActive()) {
$flashes[] = [
'type' => 'warning',
'text' => __('Receiving emails need to be configured for the mailbox in order to fetch emails from your support email address').' (<a href="'.route('mailboxes.connection.incoming', ['id' => $mailbox->id]).'">'.__("Connection Settings » Receiving Emails").'</a>)',
'unescaped' => true
'text' => __('Receiving emails need to be configured for the mailbox in order to fetch emails from your support email address').' (<a href="'.route('mailboxes.connection.incoming', ['id' => $mailbox->id]).'">'.__('Connection Settings » Receiving Emails').'</a>)',
'unescaped' => true,
];
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\ActivityLog;
use Illuminate\Http\Request;
class SecureController extends Controller
{
@@ -30,7 +30,7 @@ class SecureController extends Controller
}
/**
* Logs
* Logs.
*
* @return \Illuminate\Http\Response
*/
@@ -53,12 +53,12 @@ class SecureController extends Controller
$logs = [];
foreach ($activities as $activity) {
$log = array(
$log = [
'date' => $activity->created_at,
'user' => $activity->causer,
'event' => $activity->getEventDescription(),
);
$cols = array('date', 'user', 'event');
];
$cols = ['date', 'user', 'event'];
foreach ($activity->properties as $property_name => $property_value) {
if (!is_string($property_value)) {

View File

@@ -2,11 +2,11 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
use Illuminate\Validation\Rule;
use App\User;
use App\Mailbox;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Validator;
class UsersController extends Controller
{
@@ -21,7 +21,7 @@ class UsersController extends Controller
}
/**
* Users list
* Users list.
*/
public function users()
{
@@ -31,7 +31,7 @@ class UsersController extends Controller
}
/**
* New user
* New user.
*/
public function create()
{
@@ -42,7 +42,7 @@ class UsersController extends Controller
}
/**
* Create new mailbox
* Create new mailbox.
*
* @param \Illuminate\Http\Request $request
*/
@@ -55,7 +55,7 @@ class UsersController extends Controller
'first_name' => 'required|string|max:20',
'last_name' => 'required|string|max:30',
'email' => 'required|string|email|max:100|unique:users',
'role' => [ 'required', Rule::in(array_keys(User::$roles))]
'role' => ['required', Rule::in(array_keys(User::$roles))],
];
if (empty($request->send_invite)) {
$rules['password'] = 'required|string|max:255';
@@ -68,7 +68,7 @@ class UsersController extends Controller
->withInput();
}
$user = new User;
$user = new User();
$user->fill($request->all());
if (!empty($request->send_invite)) {
@@ -86,11 +86,12 @@ class UsersController extends Controller
}
\Session::flash('flash_success', __('User created successfully'));
return redirect()->route('users.profile', ['id' => $user->id]);
}
/**
* User profile
* User profile.
*/
public function profile($id)
{
@@ -107,6 +108,7 @@ class UsersController extends Controller
* Handle a registration request for the application.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function profileSave($id, Request $request)
@@ -123,7 +125,7 @@ class UsersController extends Controller
'phone' => 'max:60',
'timezone' => 'required|string|max:255',
'time_format' => 'required',
'role' => [ 'required', Rule::in(array_keys(User::$roles))]
'role' => ['required', Rule::in(array_keys(User::$roles))],
]);
//event(new Registered($user = $this->create($request->all())));
@@ -143,11 +145,12 @@ class UsersController extends Controller
$user->save();
\Session::flash('flash_success', __('Profile saved successfully'));
return redirect()->route('users.profile', ['id' => $id]);
}
/**
* User mailboxes
* User mailboxes.
*/
public function permissions($id)
{
@@ -160,7 +163,7 @@ class UsersController extends Controller
}
/**
* Save user permissions
* Save user permissions.
*
* @param int $id
* @param \Illuminate\Http\Request $request
@@ -174,6 +177,7 @@ class UsersController extends Controller
$user->syncPersonalFolders($request->mailboxes);
\Session::flash('flash_success', __('Permissions saved successfully'));
return redirect()->route('users.permissions', ['id' => $id]);
}
}

View File

@@ -13,6 +13,7 @@ class RedirectIfAuthenticated
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)

View File

@@ -2,8 +2,8 @@
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\Failed;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogFailedLogin
{
@@ -22,6 +20,7 @@ class LogFailedLogin
* Handle the event.
*
* @param Failed $event
*
* @return void
*/
public function handle(Failed $event)

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogLockout
{
@@ -22,6 +20,7 @@ class LogLockout
* Handle the event.
*
* @param Lockout $event
*
* @return void
*/
public function handle(Lockout $event)

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogPasswordReset
{
@@ -22,6 +20,7 @@ class LogPasswordReset
* Handle the event.
*
* @param PasswordReset $event
*
* @return void
*/
public function handle(PasswordReset $event)

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\Registered;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogRegisteredUser
{
@@ -22,6 +20,7 @@ class LogRegisteredUser
* Handle the event.
*
* @param Registered $event
*
* @return void
*/
public function handle(Registered $event)

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\Login;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogSuccessfulLogin
{
@@ -22,6 +20,7 @@ class LogSuccessfulLogin
* Handle the event.
*
* @param Login $event
*
* @return void
*/
public function handle(Login $event)

View File

@@ -3,8 +3,6 @@
namespace App\Listeners;
use Illuminate\Auth\Events\Logout;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogSuccessfulLogout
{
@@ -22,6 +20,7 @@ class LogSuccessfulLogout
* Handle the event.
*
* @param Logout $event
*
* @return void
*/
public function handle(Logout $event)

View File

@@ -7,7 +7,6 @@ use Illuminate\Support\Facades\Hash;
class Mailbox extends Model
{
/**
* From Name: name that will appear in the From field when a customer views your email.
*/
@@ -23,20 +22,20 @@ class Mailbox extends Model
const TICKET_STATUS_CLOSED = 3;
/**
* Default Assignee
* Default Assignee.
*/
const TICKET_ASSIGNEE_ANYONE = 1;
const TICKET_ASSIGNEE_REPLYING_UNASSIGNED = 2;
const TICKET_ASSIGNEE_REPLYING = 3;
/**
* Email Template
* Email Template.
*/
const TEMPLATE_FANCY = 1;
const TEMPLATE_PLAIN = 2;
/**
* Sending Emails
* Sending Emails.
*/
const OUT_METHOD_PHP_MAIL = 1;
const OUT_METHOD_SENDMAIL = 2;
@@ -45,7 +44,7 @@ class Mailbox extends Model
// todo: mailgun, sendgrid, mandrill, etc
/**
* Secure Connection
* Secure Connection.
*/
const OUT_SSL_NONE = 1;
const OUT_SSL_SSL = 2;
@@ -58,7 +57,8 @@ class Mailbox extends Model
const RATINGS_PLACEMENT_BELOW = 2;
/**
* Attributes fillable using fill() method
* Attributes fillable using fill() method.
*
* @var [type]
*/
protected $fillable = ['name', 'slug', 'email', 'aliases', 'from_name', 'from_name_custom', 'ticket_status', 'ticket_assignee', 'template', 'signature', 'out_method', 'out_server', 'out_username', 'out_password', 'out_port', 'out_ssl', 'in_server', 'in_port', 'in_username', 'in_password', 'auto_reply_enabled', 'auto_reply_subject', 'auto_reply_message', 'office_hours_enabled', 'ratings', 'ratings_placement', 'ratings_text'];
@@ -67,14 +67,13 @@ class Mailbox extends Model
{
parent::boot();
self::created(function (Mailbox $model)
{
self::created(function (Mailbox $model) {
$model->slug = strtolower(substr(md5(Hash::make($model->id)), 0, 16));
});
}
/**
* Get users having access to the mailbox
* Get users having access to the mailbox.
*/
public function users()
{
@@ -82,7 +81,7 @@ class Mailbox extends Model
}
/**
* Get mailbox conversations
* Get mailbox conversations.
*/
public function conversations()
{
@@ -90,7 +89,7 @@ class Mailbox extends Model
}
/**
* Get mailbox folders
* Get mailbox folders.
*/
public function folders()
{
@@ -130,7 +129,7 @@ class Mailbox extends Model
continue;
}
foreach (Folder::$personal_types as $type) {
$folder = new Folder;
$folder = new Folder();
$folder->mailbox_id = $this->id;
$folder->user_id = $user_id;
$folder->type = $type;
@@ -155,7 +154,7 @@ class Mailbox extends Model
continue;
}
foreach (Folder::$personal_types as $type) {
$folder = new Folder;
$folder = new Folder();
$folder->mailbox_id = $this->id;
$folder->user_id = $user_id;
$folder->type = $type;
@@ -205,7 +204,6 @@ class Mailbox extends Model
{
$folders = $this->folders;
foreach ($folders as $folder) {
$folder->active_count = $folder->conversations()
->where('status', Conversation::STATUS_ACTIVE)
->count();
@@ -219,17 +217,17 @@ class Mailbox extends Model
/**
* Is mailbox available for using.
*
* @return boolean
* @return bool
*/
public function isActive()
{
return ($this->isInActive() && $this->isOutActive());
return $this->isInActive() && $this->isOutActive();
}
/**
* Is receiving emails configured for the mailbox.
*
* @return boolean
* @return bool
*/
public function isInActive()
{
@@ -243,7 +241,7 @@ class Mailbox extends Model
/**
* Is sending emails configured for the mailbox.
*
* @return boolean
* @return bool
*/
public function isOutActive()
{

View File

@@ -2,9 +2,8 @@
namespace App\Observers;
use App\Mailbox;
use App\Folder;
use App\Conversation;
use App\Mailbox;
class MailboxObserver
{
@@ -12,12 +11,13 @@ class MailboxObserver
* Listen to the Mailbox created event.
*
* @param \App\Mailbox $mailbox
*
* @return void
*/
public function created(Mailbox $mailbox)
{
foreach (Folder::$public_types as $type) {
$folder = new Folder;
$folder = new Folder();
$folder->mailbox_id = $mailbox->id;
$folder->type = $type;
$folder->save();
@@ -29,9 +29,10 @@ class MailboxObserver
* Delete the following on mailbox delete:
* - folders
* - conversations
* - user permissions
* - user permissions.
*
* @param Mailbox $mailbox
*
* @return [type] [description]
*/
public function deleting(Mailbox $mailbox)

View File

@@ -16,7 +16,7 @@ class ThreadObserver
// Update data in conversation
$conversation = $thread->conversation;
$now = date("Y-m-d H:i:s");
$now = date('Y-m-d H:i:s');
if (!in_array($thread->type, [Thread::TYPE_LINEITEM, Thread::TYPE_NOTE])) {
$conversation->threads_count++;
}
@@ -26,5 +26,4 @@ class ThreadObserver
$conversation->last_reply_at = $now;
$conversation->save();
}
}

View File

@@ -10,6 +10,7 @@ class UserObserver
* On user delete.
*
* @param Conversation $mailbox
*
* @return [type] [description]
*/
public function deleting(User $user)

View File

@@ -2,8 +2,8 @@
namespace App\Policies;
use App\User;
use App\Conversation;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class ConversationPolicy
@@ -15,6 +15,7 @@ class ConversationPolicy
*
* @param \App\User $user
* @param \App\Conversation $conversation
*
* @return bool
*/
public function view(User $user, Conversation $conversation)

View File

@@ -2,8 +2,8 @@
namespace App\Policies;
use App\User;
use App\Folder;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class FolderPolicy
@@ -15,6 +15,7 @@ class FolderPolicy
*
* @param \App\User $user
* @param \App\Folder $folder
*
* @return bool
*/
public function view(User $user, Folder $folder)

View File

@@ -2,8 +2,8 @@
namespace App\Policies;
use App\User;
use App\Mailbox;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MailboxPolicy
@@ -14,6 +14,7 @@ class MailboxPolicy
* Determine whether the user can create mailboxes.
*
* @param \App\User $user
*
* @return mixed
*/
public function create(User $user)
@@ -30,6 +31,7 @@ class MailboxPolicy
*
* @param \App\User $user
* @param \App\Mailbox $mailbox
*
* @return mixed
*/
public function update(User $user, Mailbox $mailbox)
@@ -46,6 +48,7 @@ class MailboxPolicy
*
* @param \App\User $user
* @param \App\Mailbox $mailbox
*
* @return mixed
*/
public function delete(User $user, Mailbox $mailbox)

View File

@@ -14,6 +14,7 @@ class UserPolicy
*
* @param \App\User $user
* @param \App\User $model
*
* @return mixed
*/
public function view(User $user, User $model)
@@ -29,6 +30,7 @@ class UserPolicy
* Determine whether the user can create models.
*
* @param \App\User $user
*
* @return mixed
*/
public function create(User $user)
@@ -45,6 +47,7 @@ class UserPolicy
*
* @param \App\User $user
* @param \App\User $model
*
* @return mixed
*/
public function update(User $user, User $model)
@@ -61,6 +64,7 @@ class UserPolicy
*
* @param \App\User $user
* @param \App\User $model
*
* @return mixed
*/
public function delete(User $user, User $model)

View File

@@ -2,8 +2,8 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{

View File

@@ -2,7 +2,6 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider

View File

@@ -2,8 +2,8 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{

View File

@@ -2,8 +2,8 @@
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{

View File

@@ -2,8 +2,8 @@
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{

View File

@@ -7,18 +7,18 @@ use Illuminate\Database\Eloquent\Model;
class Thread extends Model
{
/**
* By whom action performed (source_via)
* By whom action performed (source_via).
*/
const PERSON_CUSTOMER = 1;
const PERSON_USER = 2;
public static $persons = array(
public static $persons = [
self::PERSON_CUSTOMER => 'customer',
self::PERSON_USER => 'user',
);
];
/**
* Thread types
* Thread types.
*/
// Email from customer
const TYPE_CUSTOMER = 1;
@@ -51,7 +51,7 @@ class Thread extends Model
];
/**
* Statuses
* Statuses.
*/
const STATUS_ACTIVE = 1;
const STATUS_CLOSED = 2;
@@ -59,31 +59,31 @@ class Thread extends Model
const STATUS_PENDING = 4;
const STATUS_SPAM = 5;
public static $statuses = array(
public static $statuses = [
self::STATUS_ACTIVE => 'active',
self::STATUS_CLOSED => 'closed',
self::STATUS_NOCHANGE => 'nochange',
self::STATUS_PENDING => 'pending',
self::STATUS_SPAM => 'spam',
);
];
/**
* States
* States.
*/
const STATE_DRAFT = 1;
const STATE_PUBLISHED = 2;
const STATE_HIDDEN = 3;
const STATE_REVIEW = 4;
public static $states = array(
public static $states = [
self::STATE_DRAFT => 'draft',
self::STATE_PUBLISHED => 'published',
self::STATE_HIDDEN => 'hidden',
self::STATE_REVIEW => 'review',
);
];
/**
* Action associated with the line item
* Action associated with the line item.
*/
// The conversation was moved from another mailbox
const ACTION_TYPE_MOVED_FROM_MAILBOX = 1;
@@ -118,7 +118,7 @@ class Thread extends Model
];
/**
* Source types (equal to thread source types)
* Source types (equal to thread source types).
*/
const SOURCE_TYPE_EMAIL = 1;
const SOURCE_TYPE_WEB = 2;
@@ -131,7 +131,7 @@ class Thread extends Model
];
/**
* Status of the email sent to the customer or user, to whom the thread is assigned
* Status of the email sent to the customer or user, to whom the thread is assigned.
*/
const SEND_STATUS_TOSEND = 1;
const SEND_STATUS_SENT = 2;
@@ -139,7 +139,7 @@ class Thread extends Model
const SEND_STATUS_DELIVERY_ERROR = 4;
/**
* The user assigned to this thread (assignedTo)
* The user assigned to this thread (assignedTo).
*/
public function user()
{
@@ -147,7 +147,7 @@ class Thread extends Model
}
/**
* Get the thread customer
* Get the thread customer.
*/
public function customer()
{
@@ -155,7 +155,7 @@ class Thread extends Model
}
/**
* Get conversation
* Get conversation.
*/
public function conversation()
{
@@ -163,7 +163,8 @@ class Thread extends Model
}
/**
* Get sanitized body HTML
* Get sanitized body HTML.
*
* @return string
*/
public function getCleanBody()
@@ -216,30 +217,31 @@ class Thread extends Model
/**
* Get status name. Made as a function to allow status names translation.
*
* @param integer $status
* @param int $status
*
* @return string
*/
public static function getStatusName($status)
{
switch ($status) {
case self::STATUS_ACTIVE:
return __("Active");
return __('Active');
break;
case self::STATUS_PENDING:
return __("Pending");
return __('Pending');
break;
case self::STATUS_CLOSED:
return __("Closed");
return __('Closed');
break;
case self::STATUS_SPAM:
return __("Spam");
return __('Spam');
break;
case self::STATUS_NOCHANGE:
return __("Not changed");
return __('Not changed');
break;
default:

View File

@@ -3,13 +3,13 @@
* User model class.
* Class also responsible for dates conversion and representation.
*/
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Hash;
use App\Mailbox;
use Carbon\Carbon;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
class User extends Authenticatable
{
@@ -19,31 +19,31 @@ class User extends Authenticatable
// const UPDATED_AT = 'modified_at';
/**
* Roles
* Roles.
*/
const ROLE_USER = 1;
const ROLE_ADMIN = 2;
public static $roles = array(
public static $roles = [
self::ROLE_ADMIN => 'admin',
self::ROLE_USER => 'user'
);
self::ROLE_USER => 'user',
];
/**
* Types
* Types.
*/
const TYPE_USER = 1;
const TYPE_TEAM = 2;
/**
* Invite states
* Invite states.
*/
const INVITE_STATE_ACTIVATED = 0;
const INVITE_STATE_NOT_INVITED = 1;
const INVITE_STATE_SENT = 2;
/**
* Time formats
* Time formats.
*/
const TIME_FORMAT_12 = 1;
const TIME_FORMAT_24 = 2;
@@ -65,13 +65,14 @@ class User extends Authenticatable
];
/**
* Attributes fillable using fill() method
* Attributes fillable using fill() method.
*
* @var [type]
*/
protected $fillable = ['role', 'first_name', 'last_name', 'email', 'password', 'role', 'timezone', 'photo_url', 'type', 'emails', 'job_title', 'phone', 'time_format', 'enable_kb_shortcuts'];
/**
* Get mailboxes to which usre has access
* Get mailboxes to which usre has access.
*/
public function mailboxes()
{
@@ -79,7 +80,7 @@ class User extends Authenticatable
}
/**
* Get conversations assigned to user
* Get conversations assigned to user.
*/
public function conversations()
{
@@ -87,7 +88,7 @@ class User extends Authenticatable
}
/**
* User's folders
* User's folders.
*/
public function folders()
{
@@ -95,7 +96,7 @@ class User extends Authenticatable
}
/**
* Get user role
* Get user role.
*
* @return string
*/
@@ -105,30 +106,32 @@ class User extends Authenticatable
if ($ucfirst) {
$role_name = ucfirst($role_name);
}
return $role_name;
}
/**
* Check if user is admin
* Check if user is admin.
*
* @return boolean
* @return bool
*/
public function isAdmin()
{
return ($this->role == self::ROLE_ADMIN);
return $this->role == self::ROLE_ADMIN;
}
/**
* Get user full name
* Get user full name.
*
* @return string
*/
public function getFullName()
{
return $this->first_name . ' ' . $this->last_name;
return $this->first_name.' '.$this->last_name;
}
/**
* Get mailboxes to which user has access
* Get mailboxes to which user has access.
*/
public function mailboxesCanView()
{
@@ -140,18 +143,22 @@ class User extends Authenticatable
}
/**
* Generate random password for the user
* @param integer $length
* Generate random password for the user.
*
* @param int $length
*
* @return string
*/
public function generatePassword($length = 8)
{
$this->password = Hash::make(str_random($length));
return $this->password;
}
/**
* Get URL for editing user
* Get URL for editing user.
*
* @return string
*/
public function urlEdit()
@@ -162,7 +169,7 @@ class User extends Authenticatable
/**
* Create personal folders for user mailboxes.
*
* @param integer $mailbox_id
* @param int $mailbox_id
* @param mixed $users
*/
public function syncPersonalFolders($mailboxes)
@@ -185,7 +192,7 @@ class User extends Authenticatable
continue;
}
foreach (Folder::$personal_types as $type) {
$folder = new Folder;
$folder = new Folder();
$folder->mailbox_id = $mailbox_id;
$folder->user_id = $this->id;
$folder->type = $type;
@@ -199,6 +206,7 @@ class User extends Authenticatable
*
* @param Carbon $date
* @param string $format
*
* @return string
*/
public static function dateFormat($date, $format)
@@ -232,6 +240,7 @@ class User extends Authenticatable
* Convert date into human readable format.
*
* @param Carbon $date
*
* @return string
*/
public static function dateDiffForHumans($date)
@@ -242,17 +251,18 @@ class User extends Authenticatable
}
if ($date->diffInSeconds(Carbon::now()) <= 60) {
return __("Just now");
return __('Just now');
} elseif ($date->diffInDays(Carbon::now()) > 7) {
// Exact date
if (Carbon::now()->year == $date->year) {
return User::dateFormat($date, "M j");
return self::dateFormat($date, 'M j');
} else {
return User::dateFormat($date, "M j, Y");
return self::dateFormat($date, 'M j, Y');
}
} else {
$diff_text = $date->diffForHumans();
$diff_text = preg_replace("/minutes?/", 'min', $diff_text);
$diff_text = preg_replace('/minutes?/', 'min', $diff_text);
return $diff_text;
}
}

View File

@@ -1,6 +1,6 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
@@ -24,9 +24,9 @@ return array(
|
*/
'ignore_environments' => array(
'ignore_environments' => [
'local',
),
],
/*
|--------------------------------------------------------------------------
@@ -80,5 +80,5 @@ return array(
| value. By default if empty HTTP_HOST would be used.
|
*/
'base_url' => ''
);
'base_url' => '',
];

View File

@@ -1,10 +1,9 @@
<?php
use Faker\Generator as Faker;
use App\Conversation;
use Faker\Generator as Faker;
$factory->define(Conversation::class, function (Faker $faker, $params) {
if (!empty($params['created_by'])) {
$created_by = $params['created_by'];
} else {
@@ -23,6 +22,7 @@ $factory->define(Conversation::class, function (Faker $faker, $params) {
$folder_id = factory(App\Folder::class)->create()->id;
}
}
return [
'type' => $faker->randomElement([Conversation::TYPE_EMAIL, Conversation::TYPE_PHONE]),
'folder_id' => $folder_id,

View File

@@ -1,13 +1,13 @@
<?php
use Faker\Generator as Faker;
use App\Customer;
use Faker\Generator as Faker;
$factory->define(App\Customer::class, function (Faker $faker) {
return [
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'job_title' => $faker->jobTitle,
'phones' => Customer::formatPhones([['value' => $faker->phoneNumber, 'type' => Customer::PHONE_TYPE_WORK]])
'phones' => Customer::formatPhones([['value' => $faker->phoneNumber, 'type' => Customer::PHONE_TYPE_WORK]]),
];
});

View File

@@ -1,7 +1,7 @@
<?php
use Faker\Generator as Faker;
use App\Folder;
use Faker\Generator as Faker;
$factory->define(App\Folder::class, function (Faker $faker, $params) {
$mailbox_id = null;
@@ -13,6 +13,7 @@ $factory->define(App\Folder::class, function (Faker $faker, $params) {
$mailbox_id = $mailbox->id;
}
}
return [
'mailbox_id' => $mailbox_id,
'type' => Folder::TYPE_UNASSIGNED,

View File

@@ -6,6 +6,7 @@ $factory->define(App\Mailbox::class, function (Faker $faker) {
$name = $faker->company;
$email = $faker->unique()->companyEmail;
$domain = explode('@', $email)[1];
return [
'name' => $name,
'email' => $email,

View File

@@ -1,10 +1,9 @@
<?php
use Faker\Generator as Faker;
use App\Thread;
use Faker\Generator as Faker;
$factory->define(Thread::class, function (Faker $faker, $params) {
if (!empty($params['customer_id'])) {
$customer_id = $params['customer_id'];
} else {
@@ -23,6 +22,7 @@ $factory->define(Thread::class, function (Faker $faker, $params) {
} else {
$to = json_encode([$faker->unique()->safeEmail]);
}
return [
'type' => Thread::TYPE_CUSTOMER,
//'conversation_id' => ,

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Mailbox;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMailboxesTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMailboxUserTable extends Migration
{

View File

@@ -1,7 +1,7 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateActivityLogTable extends Migration
{

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Email;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmailsTable extends Migration
{

View File

@@ -1,9 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Customer;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCustomersTable extends Migration
{

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Conversation;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateConversationsTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFoldersTable extends Migration
{

View File

@@ -1,10 +1,10 @@
<?php
/**
* Table stores conversations which user marked as starred
* Table stores conversations which user marked as starred.
*/
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateConversationFolderTable extends Migration
{

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Thread;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateThreadsTable extends Migration
{

View File

@@ -1,7 +1,7 @@
<?php
use Illuminate\Database\Seeder;
use App\Conversation;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
@@ -17,8 +17,7 @@ class DatabaseSeeder extends Seeder
$user = factory(App\User::class)->create();
$m->users()->save($user);
for ($i=0; $i < 7; $i++) {
for ($i = 0; $i < 7; $i++) {
$customer = factory(App\Customer::class)->create();
$customer->emails()->save(factory(App\Email::class)->make());

View File

@@ -1,12 +1,10 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans
* Laravel - A PHP Framework For Web Artisans.
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
define('LARAVEL_START', microtime(true));
/*

View File

@@ -13,11 +13,11 @@
Auth::routes();
# General routes for logged in users
// General routes for logged in users
Route::get('/', 'SecureController@dashboard')->name('dashboard');
Route::get('/logs/{name?}', 'SecureController@logs')->name('logs');
# Users
// Users
Route::get('/users', 'UsersController@users')->name('users');
Route::get('/users/wizard', 'UsersController@create')->name('users.create');
Route::post('/users/wizard', 'UsersController@createSave');
@@ -27,7 +27,7 @@ Route::post('/users/permissions/{id}', 'UsersController@permissionsSave');
Route::get('/users/permissions/{id}', 'UsersController@permissions')->name('users.permissions');
Route::post('/users/permissions/{id}', 'UsersController@permissionsSave');
# Mailboxes
// Mailboxes
Route::get('/settings/mailboxes', 'MailboxesController@mailboxes')->name('mailboxes');
Route::get('/settings/mailbox-new', 'MailboxesController@create')->name('mailboxes.create');
Route::post('/settings/mailbox-new', 'MailboxesController@createSave');
@@ -42,10 +42,10 @@ Route::post('/settings/connection-settings/{id}/outgoing', 'MailboxesController@
Route::get('/settings/connection-settings/{id}/incoming', 'MailboxesController@connectionIncoming')->name('mailboxes.connection.incoming');
Route::post('/settings/connection-settings/{id}/incoming', 'MailboxesController@connectionIncomingSave');
# Customers
// Customers
Route::get('/customer/{id}/edit', 'CustomersController@update')->name('customers.update');
Route::post('/customer/{id}/edit', 'CustomersController@updateSave');
Route::get('/customer/{id}/', 'CustomersController@conversations')->name('customers.conversations');
# Conversations
// Conversations
Route::get('/conversation/{id}', 'ConversationsController@view')->name('conversations.view');

View File

@@ -1,12 +1,10 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans
* Laravel - A PHP Framework For Web Artisans.
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

View File

@@ -2,8 +2,8 @@
namespace Tests;
use Illuminate\Support\Facades\Hash;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\Hash;
trait CreatesApplication
{

View File

@@ -3,7 +3,6 @@
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{