Apply fixes from StyleCI
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
|
||||
@@ -6,37 +6,37 @@ 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',
|
||||
);
|
||||
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(
|
||||
self::TYPE_EMAIL => 'email',
|
||||
self::TYPE_PHONE => 'phone',
|
||||
self::TYPE_CHAT => 'chat',
|
||||
);
|
||||
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(
|
||||
self::STATUS_ACTIVE => 'active',
|
||||
public static $statuses = [
|
||||
self::STATUS_ACTIVE => 'active',
|
||||
self::STATUS_PENDING => 'pending',
|
||||
self::STATUS_CLOSED => 'closed',
|
||||
self::STATUS_SPAM => 'spam',
|
||||
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(
|
||||
self::STATUS_ACTIVE => 'ok',
|
||||
public static $status_icons = [
|
||||
self::STATUS_ACTIVE => 'ok',
|
||||
self::STATUS_PENDING => 'hourglass',
|
||||
self::STATUS_CLOSED => 'lock',
|
||||
self::STATUS_SPAM => 'ban-circle',
|
||||
self::STATUS_CLOSED => 'lock',
|
||||
self::STATUS_SPAM => 'ban-circle',
|
||||
//self::STATUS_OPEN => 'folder-open',
|
||||
);
|
||||
];
|
||||
|
||||
public static $status_colors = array(
|
||||
self::STATUS_ACTIVE => 'success',
|
||||
public static $status_colors = [
|
||||
self::STATUS_ACTIVE => 'success',
|
||||
self::STATUS_PENDING => 'warning',
|
||||
self::STATUS_CLOSED => 'grey',
|
||||
self::STATUS_SPAM => 'danger',
|
||||
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(
|
||||
self::STATE_DRAFT => 'draft',
|
||||
self::STATE_PUBLISHED => 'published',
|
||||
self::STATE_DELETED => 'deleted',
|
||||
);
|
||||
|
||||
/**
|
||||
* Source types (equal to thread source types)
|
||||
public static $states = [
|
||||
self::STATE_DRAFT => 'draft',
|
||||
self::STATE_PUBLISHED => 'published',
|
||||
self::STATE_DELETED => 'deleted',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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(
|
||||
self::SOURCE_TYPE_EMAIL => 'email',
|
||||
self::SOURCE_TYPE_WEB => 'web',
|
||||
self::SOURCE_TYPE_API => 'api',
|
||||
);
|
||||
|
||||
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,8 +166,8 @@ class Conversation extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Set preview text
|
||||
*
|
||||
* Set preview text.
|
||||
*
|
||||
* @param string $text
|
||||
*/
|
||||
public function setPreview($text = '')
|
||||
@@ -183,22 +182,24 @@ class Conversation extends Model
|
||||
$this->preview = mb_substr($first_thread->body, 0, self::PREVIEW_MAXLENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversation timestamp title.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -209,31 +210,32 @@ class Conversation extends Model
|
||||
|
||||
/**
|
||||
* Get status name.
|
||||
*
|
||||
* @param integer $status
|
||||
* @return string
|
||||
*
|
||||
* @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:
|
||||
|
||||
690
app/Customer.php
690
app/Customer.php
@@ -3,28 +3,27 @@
|
||||
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',
|
||||
self::GENDER_MALE => 'male',
|
||||
self::GENDER_FEMALE => 'female',
|
||||
self::GENDER_MALE => 'male',
|
||||
self::GENDER_FEMALE => 'female',
|
||||
];
|
||||
|
||||
/**
|
||||
* Phone types
|
||||
* Phone types.
|
||||
*/
|
||||
const PHONE_TYPE_WORK = 1;
|
||||
const PHONE_TYPE_HOME = 2;
|
||||
@@ -34,19 +33,19 @@ class Customer extends Model
|
||||
const PHONE_TYPE_PAGER = 6;
|
||||
|
||||
/**
|
||||
* For API
|
||||
* For API.
|
||||
*/
|
||||
public static $phone_types = [
|
||||
self::PHONE_TYPE_WORK => 'work',
|
||||
self::PHONE_TYPE_HOME => 'home',
|
||||
self::PHONE_TYPE_OTHER => 'other',
|
||||
self::PHONE_TYPE_MOBILE => 'mobile',
|
||||
self::PHONE_TYPE_FAX => 'Fax',
|
||||
self::PHONE_TYPE_PAGER => 'pager',
|
||||
self::PHONE_TYPE_WORK => 'work',
|
||||
self::PHONE_TYPE_HOME => 'home',
|
||||
self::PHONE_TYPE_OTHER => 'other',
|
||||
self::PHONE_TYPE_MOBILE => 'mobile',
|
||||
self::PHONE_TYPE_FAX => 'Fax',
|
||||
self::PHONE_TYPE_PAGER => 'pager',
|
||||
];
|
||||
|
||||
/**
|
||||
* Photo types
|
||||
* Photo types.
|
||||
*/
|
||||
const PHOTO_TYPE_UKNOWN = 1;
|
||||
const PHOTO_TYPE_GRAVATAR = 2;
|
||||
@@ -58,21 +57,21 @@ class Customer extends Model
|
||||
const PHOTO_TYPE_VK = 8; // Extra
|
||||
|
||||
/**
|
||||
* For API
|
||||
* For API.
|
||||
*/
|
||||
public static $photo_types = [
|
||||
self::PHOTO_TYPE_UKNOWN => 'unknown',
|
||||
self::PHOTO_TYPE_GRAVATAR => 'gravatar',
|
||||
self::PHOTO_TYPE_TWITTER => 'twitter',
|
||||
self::PHOTO_TYPE_FACEBOOK => 'facebook',
|
||||
self::PHOTO_TYPE_UKNOWN => 'unknown',
|
||||
self::PHOTO_TYPE_GRAVATAR => 'gravatar',
|
||||
self::PHOTO_TYPE_TWITTER => 'twitter',
|
||||
self::PHOTO_TYPE_FACEBOOK => 'facebook',
|
||||
self::PHOTO_TYPE_GOOGLEPROFILE => 'googleprofile',
|
||||
self::PHOTO_TYPE_GOOGLEPLUS => 'googleplus',
|
||||
self::PHOTO_TYPE_LINKEDIN => 'linkedin',
|
||||
self::PHOTO_TYPE_VK => 'vk', // Extra
|
||||
self::PHOTO_TYPE_GOOGLEPLUS => 'googleplus',
|
||||
self::PHOTO_TYPE_LINKEDIN => 'linkedin',
|
||||
self::PHOTO_TYPE_VK => 'vk', // Extra
|
||||
];
|
||||
|
||||
/**
|
||||
* Chat types
|
||||
* Chat types.
|
||||
*/
|
||||
const CHAT_TYPE_AIM = 1;
|
||||
const CHAT_TYPE_GTALK = 2;
|
||||
@@ -86,36 +85,36 @@ class Customer extends Model
|
||||
const CHAT_TYPE_OTHER = 9;
|
||||
|
||||
/**
|
||||
* For API
|
||||
* For API.
|
||||
*/
|
||||
public static $chat_types = [
|
||||
self::CHAT_TYPE_AIM => 'aim',
|
||||
self::CHAT_TYPE_GTALK => 'gtalk',
|
||||
self::CHAT_TYPE_ICQ => 'icq',
|
||||
self::CHAT_TYPE_XMPP => 'xmpp',
|
||||
self::CHAT_TYPE_MSN => 'msn',
|
||||
self::CHAT_TYPE_SKYPE => 'skype',
|
||||
self::CHAT_TYPE_YAHOO => 'yahoo',
|
||||
self::CHAT_TYPE_QQ => 'qq',
|
||||
self::CHAT_TYPE_AIM => 'aim',
|
||||
self::CHAT_TYPE_GTALK => 'gtalk',
|
||||
self::CHAT_TYPE_ICQ => 'icq',
|
||||
self::CHAT_TYPE_XMPP => 'xmpp',
|
||||
self::CHAT_TYPE_MSN => 'msn',
|
||||
self::CHAT_TYPE_SKYPE => 'skype',
|
||||
self::CHAT_TYPE_YAHOO => 'yahoo',
|
||||
self::CHAT_TYPE_QQ => 'qq',
|
||||
self::CHAT_TYPE_WECHAT => 'wechat', // Extra
|
||||
self::CHAT_TYPE_OTHER => 'other',
|
||||
self::CHAT_TYPE_OTHER => 'other',
|
||||
];
|
||||
|
||||
public static $chat_type_names = [
|
||||
self::CHAT_TYPE_AIM => 'AIM',
|
||||
self::CHAT_TYPE_GTALK => 'Google+',
|
||||
self::CHAT_TYPE_ICQ => 'ICQ',
|
||||
self::CHAT_TYPE_XMPP => 'XMPP',
|
||||
self::CHAT_TYPE_MSN => 'MSN',
|
||||
self::CHAT_TYPE_SKYPE => 'Skype',
|
||||
self::CHAT_TYPE_YAHOO => 'Yahoo',
|
||||
self::CHAT_TYPE_QQ => 'QQ',
|
||||
self::CHAT_TYPE_AIM => 'AIM',
|
||||
self::CHAT_TYPE_GTALK => 'Google+',
|
||||
self::CHAT_TYPE_ICQ => 'ICQ',
|
||||
self::CHAT_TYPE_XMPP => 'XMPP',
|
||||
self::CHAT_TYPE_MSN => 'MSN',
|
||||
self::CHAT_TYPE_SKYPE => 'Skype',
|
||||
self::CHAT_TYPE_YAHOO => 'Yahoo',
|
||||
self::CHAT_TYPE_QQ => 'QQ',
|
||||
self::CHAT_TYPE_WECHAT => 'WeChat', // Extra
|
||||
self::CHAT_TYPE_OTHER => 'Other',
|
||||
self::CHAT_TYPE_OTHER => 'Other',
|
||||
];
|
||||
|
||||
/**
|
||||
* Social types
|
||||
* Social types.
|
||||
*/
|
||||
const SOCIAL_TYPE_TWITTER = 1;
|
||||
const SOCIAL_TYPE_FACEBOOK = 2;
|
||||
@@ -132,306 +131,307 @@ class Customer extends Model
|
||||
const SOCIAL_TYPE_OTHER = 12;
|
||||
|
||||
public static $social_types = [
|
||||
self::SOCIAL_TYPE_TWITTER => 'twitter',
|
||||
self::SOCIAL_TYPE_FACEBOOK => 'facebook',
|
||||
self::SOCIAL_TYPE_LINKEDIN => 'linkedin',
|
||||
self::SOCIAL_TYPE_ABOUTME => 'aboutme',
|
||||
self::SOCIAL_TYPE_GOOGLE => 'google',
|
||||
self::SOCIAL_TYPE_TWITTER => 'twitter',
|
||||
self::SOCIAL_TYPE_FACEBOOK => 'facebook',
|
||||
self::SOCIAL_TYPE_LINKEDIN => 'linkedin',
|
||||
self::SOCIAL_TYPE_ABOUTME => 'aboutme',
|
||||
self::SOCIAL_TYPE_GOOGLE => 'google',
|
||||
self::SOCIAL_TYPE_GOOGLEPLUS => 'googleplus',
|
||||
self::SOCIAL_TYPE_TUNGLEME => 'tungleme',
|
||||
self::SOCIAL_TYPE_QUORA => 'quora',
|
||||
self::SOCIAL_TYPE_TUNGLEME => 'tungleme',
|
||||
self::SOCIAL_TYPE_QUORA => 'quora',
|
||||
self::SOCIAL_TYPE_FOURSQUARE => 'foursquare',
|
||||
self::SOCIAL_TYPE_YOUTUBE => 'youtube',
|
||||
self::SOCIAL_TYPE_FLICKR => 'flickr',
|
||||
self::SOCIAL_TYPE_VK => 'vk', // Extra
|
||||
self::SOCIAL_TYPE_OTHER => 'other',
|
||||
self::SOCIAL_TYPE_YOUTUBE => 'youtube',
|
||||
self::SOCIAL_TYPE_FLICKR => 'flickr',
|
||||
self::SOCIAL_TYPE_VK => 'vk', // Extra
|
||||
self::SOCIAL_TYPE_OTHER => 'other',
|
||||
];
|
||||
|
||||
public static $social_type_names = [
|
||||
self::SOCIAL_TYPE_TWITTER => 'Twitter',
|
||||
self::SOCIAL_TYPE_FACEBOOK => 'Facebook',
|
||||
self::SOCIAL_TYPE_LINKEDIN => 'Linkedin',
|
||||
self::SOCIAL_TYPE_ABOUTME => 'About.me',
|
||||
self::SOCIAL_TYPE_GOOGLE => 'Google',
|
||||
self::SOCIAL_TYPE_TWITTER => 'Twitter',
|
||||
self::SOCIAL_TYPE_FACEBOOK => 'Facebook',
|
||||
self::SOCIAL_TYPE_LINKEDIN => 'Linkedin',
|
||||
self::SOCIAL_TYPE_ABOUTME => 'About.me',
|
||||
self::SOCIAL_TYPE_GOOGLE => 'Google',
|
||||
self::SOCIAL_TYPE_GOOGLEPLUS => 'Google+',
|
||||
self::SOCIAL_TYPE_TUNGLEME => 'Tungle.me',
|
||||
self::SOCIAL_TYPE_QUORA => 'Quora',
|
||||
self::SOCIAL_TYPE_TUNGLEME => 'Tungle.me',
|
||||
self::SOCIAL_TYPE_QUORA => 'Quora',
|
||||
self::SOCIAL_TYPE_FOURSQUARE => 'Foursquare',
|
||||
self::SOCIAL_TYPE_YOUTUBE => 'YouTube',
|
||||
self::SOCIAL_TYPE_FLICKR => 'Flickr',
|
||||
self::SOCIAL_TYPE_VK => 'VK',
|
||||
self::SOCIAL_TYPE_OTHER => 'Other',
|
||||
self::SOCIAL_TYPE_YOUTUBE => 'YouTube',
|
||||
self::SOCIAL_TYPE_FLICKR => 'Flickr',
|
||||
self::SOCIAL_TYPE_VK => 'VK',
|
||||
self::SOCIAL_TYPE_OTHER => 'Other',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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'];
|
||||
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()
|
||||
{
|
||||
@@ -456,23 +456,24 @@ class Customer extends Model
|
||||
|
||||
/**
|
||||
* Get customer full name.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
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 {
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customer emails
|
||||
* @param array $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();
|
||||
@@ -518,7 +519,7 @@ class Customer extends Model
|
||||
|
||||
/**
|
||||
* Get customers phones as array.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPhones()
|
||||
@@ -532,7 +533,7 @@ class Customer extends Model
|
||||
|
||||
/**
|
||||
* Set phones as JSON.
|
||||
*
|
||||
*
|
||||
* @param array $phones_array
|
||||
*/
|
||||
public function setPhones(array $phones_array)
|
||||
@@ -541,10 +542,11 @@ class Customer extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize phones array
|
||||
*
|
||||
* @param array $phones_array [description]
|
||||
* @return array [description]
|
||||
* Sanitize phones array.
|
||||
*
|
||||
* @param array $phones_array [description]
|
||||
*
|
||||
* @return array [description]
|
||||
*/
|
||||
public static function formatPhones(array $phones_array)
|
||||
{
|
||||
@@ -552,17 +554,18 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customers social profiles as array.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSocialProfiles()
|
||||
@@ -576,7 +579,7 @@ class Customer extends Model
|
||||
|
||||
/**
|
||||
* Get customers social profiles as array.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getWebsites($dummy_if_empty = false)
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -6,22 +6,22 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Email extends Model
|
||||
{
|
||||
/**
|
||||
* Email types
|
||||
*/
|
||||
const TYPE_WORK = 'work';
|
||||
const TYPE_HOME = 'home';
|
||||
const TYPE_OTHER = 'other';
|
||||
/**
|
||||
* Email types.
|
||||
*/
|
||||
const TYPE_WORK = 'work';
|
||||
const TYPE_HOME = 'home';
|
||||
const TYPE_OTHER = 'other';
|
||||
|
||||
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,9 +29,11 @@ class Email extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanatize email address
|
||||
* @param string $email
|
||||
* @return string
|
||||
* Sanatize email address.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanatizeEmail($email)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -31,7 +31,8 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
@@ -42,8 +43,9 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
|
||||
@@ -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
|
||||
@@ -23,27 +22,27 @@ class Folder extends Model
|
||||
|
||||
public static $types = [
|
||||
self::TYPE_UNASSIGNED => 'Unassigned',
|
||||
self::TYPE_MINE => 'Mine',
|
||||
self::TYPE_DRAFTS => 'Drafts',
|
||||
self::TYPE_ASSIGNED => 'Assigned',
|
||||
self::TYPE_CLOSED => 'Closed',
|
||||
self::TYPE_SPAM => 'Spam',
|
||||
self::TYPE_DELETED => 'Deleted',
|
||||
self::TYPE_STARRED => 'Starred',
|
||||
self::TYPE_MINE => 'Mine',
|
||||
self::TYPE_DRAFTS => 'Drafts',
|
||||
self::TYPE_ASSIGNED => 'Assigned',
|
||||
self::TYPE_CLOSED => 'Closed',
|
||||
self::TYPE_SPAM => 'Spam',
|
||||
self::TYPE_DELETED => 'Deleted',
|
||||
self::TYPE_STARRED => 'Starred',
|
||||
];
|
||||
|
||||
/**
|
||||
* https://glyphicons.bootstrapcheatsheets.com/
|
||||
* https://glyphicons.bootstrapcheatsheets.com/.
|
||||
*/
|
||||
public static $type_icons = [
|
||||
self::TYPE_UNASSIGNED => 'folder-open',
|
||||
self::TYPE_MINE => 'hand-right',
|
||||
self::TYPE_DRAFTS => 'duplicate',
|
||||
self::TYPE_ASSIGNED => 'user',
|
||||
self::TYPE_CLOSED => 'lock', // lock
|
||||
self::TYPE_SPAM => 'ban-circle',
|
||||
self::TYPE_DELETED => 'trash',
|
||||
self::TYPE_STARRED => 'star',
|
||||
self::TYPE_MINE => 'hand-right',
|
||||
self::TYPE_DRAFTS => 'duplicate',
|
||||
self::TYPE_ASSIGNED => 'user',
|
||||
self::TYPE_CLOSED => 'lock', // lock
|
||||
self::TYPE_SPAM => 'ban-circle',
|
||||
self::TYPE_DELETED => 'trash',
|
||||
self::TYPE_STARRED => 'star',
|
||||
];
|
||||
|
||||
// Public non-user specific mailbox types
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -42,37 +42,39 @@ class RegisterController extends Controller
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'first_name' => 'required|string|max:255',
|
||||
'last_name' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:191|unique:users',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
'last_name' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:191|unique:users',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'first_name' => $data['first_name'],
|
||||
'last_name' => $data['last_name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
'last_name' => $data['last_name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration is disabled
|
||||
* Registration is disabled.
|
||||
*/
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
@@ -81,6 +83,5 @@ class RegisterController extends Controller
|
||||
|
||||
public function register()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Validator;
|
||||
use App\Conversation;
|
||||
|
||||
class ConversationsController extends Controller
|
||||
@@ -29,11 +27,11 @@ class ConversationsController extends Controller
|
||||
|
||||
return view('conversations/view', [
|
||||
'conversation' => $conversation,
|
||||
'mailbox' => $conversation->mailbox,
|
||||
'customer' => $conversation->customer,
|
||||
'threads' => $conversation->threads,
|
||||
'folder' => $conversation->folder,
|
||||
'folders' => $conversation->mailbox->getAssesibleFolders()
|
||||
'mailbox' => $conversation->mailbox,
|
||||
'customer' => $conversation->customer,
|
||||
'threads' => $conversation->threads,
|
||||
'folder' => $conversation->folder,
|
||||
'folders' => $conversation->mailbox->getAssesibleFolders(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -42,7 +40,8 @@ class CustomersController extends Controller
|
||||
/**
|
||||
* Save customer.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function updateSave($id, Request $request)
|
||||
@@ -51,11 +50,11 @@ class CustomersController extends Controller
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'first_name' => 'nullable|string|max:255',
|
||||
'last_name' => 'nullable|string|max:255',
|
||||
'city' => 'nullable|string|max:255',
|
||||
'state' => 'nullable|string|max:255',
|
||||
'zip' => 'nullable|string|max:12',
|
||||
'country' => 'nullable|string|max:2',
|
||||
'last_name' => 'nullable|string|max:255',
|
||||
'city' => 'nullable|string|max:255',
|
||||
'state' => 'nullable|string|max:255',
|
||||
'zip' => 'nullable|string|max:12',
|
||||
'country' => 'nullable|string|max:2',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
@@ -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,10 +91,10 @@ class CustomersController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Save user permissions
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* Save user permissions.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function permissionsSave($id, Request $request)
|
||||
{
|
||||
@@ -104,13 +104,14 @@ class CustomersController extends Controller
|
||||
$user->mailboxes()->sync($request->mailboxes);
|
||||
|
||||
\Session::flash('flash_success', __('Permissions saved successfully'));
|
||||
|
||||
return redirect()->route('users.permissions', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* View customer conversations.
|
||||
*
|
||||
* @param intg $id
|
||||
*
|
||||
* @param intg $id
|
||||
*/
|
||||
public function conversations($id)
|
||||
{
|
||||
|
||||
@@ -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,21 +32,21 @@ class MailboxesController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* New mailbox
|
||||
* New mailbox.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->authorize('create', 'App\Mailbox');
|
||||
|
||||
|
||||
$users = User::where('role', '!=', User::ROLE_ADMIN)->get();
|
||||
|
||||
return view('mailboxes/create', ['users' => $users]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new mailbox
|
||||
* Create new mailbox.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function createSave(Request $request)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ class MailboxesController extends Controller
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|string|email|max:128|unique:mailboxes',
|
||||
'name' => 'required|string|max:40',
|
||||
'name' => 'required|string|max:40',
|
||||
]);
|
||||
|
||||
// //event(new Registered($user = $this->create($request->all())));
|
||||
@@ -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,10 +91,10 @@ class MailboxesController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Save mailbox
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* Save mailbox.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function updateSave($id, Request $request)
|
||||
{
|
||||
@@ -102,15 +103,15 @@ class MailboxesController extends Controller
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|max:40',
|
||||
'email' => 'required|string|email|max:128|unique:mailboxes,email,'.$id,
|
||||
'aliases' => 'string|max:128',
|
||||
'from_name' => 'required|integer',
|
||||
'name' => 'required|string|max:40',
|
||||
'email' => 'required|string|email|max:128|unique:mailboxes,email,'.$id,
|
||||
'aliases' => 'string|max:128',
|
||||
'from_name' => 'required|integer',
|
||||
'from_name_custom' => 'nullable|string|max:128',
|
||||
'ticket_status' => 'required|integer',
|
||||
'template' => 'required|integer',
|
||||
'ticket_assignee' => 'required|integer',
|
||||
'signature' => 'nullable|string',
|
||||
'ticket_status' => 'required|integer',
|
||||
'template' => 'required|integer',
|
||||
'ticket_assignee' => 'required|integer',
|
||||
'signature' => 'nullable|string',
|
||||
]);
|
||||
|
||||
//event(new Registered($user = $this->create($request->all())));
|
||||
@@ -126,16 +127,17 @@ 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)
|
||||
{
|
||||
$mailbox = Mailbox::findOrFail($id);
|
||||
|
||||
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
$users = User::where('role', '!=', User::ROLE_ADMIN)->get();
|
||||
@@ -144,10 +146,10 @@ class MailboxesController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Save mailbox permissions
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* Save mailbox permissions.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function permissionsSave($id, 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)
|
||||
{
|
||||
@@ -182,11 +185,11 @@ class MailboxesController extends Controller
|
||||
|
||||
if ($request->out_method == Mailbox::OUT_METHOD_SMTP) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'out_server' => 'required|string|max:255',
|
||||
'out_port' => 'required|integer',
|
||||
'out_server' => 'required|string|max:255',
|
||||
'out_port' => 'required|integer',
|
||||
'out_username' => 'required|string|max:100',
|
||||
'out_password' => 'required|string|max:255',
|
||||
'out_ssl' => 'required|integer',
|
||||
'out_ssl' => 'required|integer',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
@@ -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)
|
||||
{
|
||||
@@ -223,8 +227,8 @@ class MailboxesController extends Controller
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'in_server' => 'required|string|max:255',
|
||||
'in_port' => 'required|integer',
|
||||
'in_server' => 'required|string|max:255',
|
||||
'in_port' => 'required|integer',
|
||||
'in_username' => 'required|string|max:100',
|
||||
'in_password' => 'required|string|max:255',
|
||||
]);
|
||||
@@ -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();
|
||||
}
|
||||
@@ -267,9 +272,9 @@ class MailboxesController extends Controller
|
||||
$this->authorize('view', $folder);
|
||||
|
||||
return view('mailboxes/view', [
|
||||
'mailbox' => $mailbox,
|
||||
'folders' => $folders,
|
||||
'folder' => $folder,
|
||||
'mailbox' => $mailbox,
|
||||
'folders' => $folders,
|
||||
'folder' => $folder,
|
||||
'conversations' => $folder->conversations()->orderBy('status', 'asc')->orderBy('last_reply_at', 'desc')->get(),
|
||||
]);
|
||||
}
|
||||
@@ -281,16 +286,16 @@ class MailboxesController extends Controller
|
||||
if ($mailbox) {
|
||||
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
|
||||
'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,
|
||||
];
|
||||
}
|
||||
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
|
||||
'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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\ActivityLog;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SecureController extends Controller
|
||||
{
|
||||
@@ -30,16 +30,16 @@ class SecureController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs
|
||||
* Logs.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function logs(Request $request)
|
||||
{
|
||||
//->where('preferences->dining->meal', 'salad')
|
||||
//->get();
|
||||
//->where('preferences->dining->meal', 'salad')
|
||||
//->get();
|
||||
$names = ActivityLog::select('log_name')->distinct()->get()->pluck('log_name');
|
||||
|
||||
|
||||
$activities = [];
|
||||
$cols = [];
|
||||
$current_name = '';
|
||||
@@ -53,12 +53,12 @@ class SecureController extends Controller
|
||||
|
||||
$logs = [];
|
||||
foreach ($activities as $activity) {
|
||||
$log = array(
|
||||
'date' => $activity->created_at,
|
||||
'user' => $activity->causer,
|
||||
$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)) {
|
||||
|
||||
@@ -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,20 +42,20 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new mailbox
|
||||
* Create new mailbox.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function createSave(Request $request)
|
||||
{
|
||||
$this->authorize('create', 'App\User');
|
||||
|
||||
$rules = [
|
||||
'role' => 'integer',
|
||||
'role' => 'integer',
|
||||
'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))]
|
||||
'last_name' => 'required|string|max:30',
|
||||
'email' => 'required|string|email|max:100|unique:users',
|
||||
'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)
|
||||
{
|
||||
@@ -106,7 +107,8 @@ class UsersController extends Controller
|
||||
/**
|
||||
* Handle a registration request for the application.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function profileSave($id, Request $request)
|
||||
@@ -115,15 +117,15 @@ class UsersController extends Controller
|
||||
$this->authorize('update', $user);
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'first_name' => 'required|string|max:20',
|
||||
'last_name' => 'required|string|max:30',
|
||||
'email' => 'required|string|email|max:100|unique:users,email,'.$id,
|
||||
'emails' => 'max:100',
|
||||
'job_title' => 'max:100',
|
||||
'phone' => 'max:60',
|
||||
'timezone' => 'required|string|max:255',
|
||||
'first_name' => 'required|string|max:20',
|
||||
'last_name' => 'required|string|max:30',
|
||||
'email' => 'required|string|email|max:100|unique:users,email,'.$id,
|
||||
'emails' => 'max:100',
|
||||
'job_title' => 'max:100',
|
||||
'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,10 +163,10 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Save user permissions
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* Save user permissions.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function permissionsSave($id, 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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ class Kernel extends HttpKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,9 +10,10 @@ class RedirectIfAuthenticated
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -20,10 +20,10 @@ class TrustProxies extends Middleware
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = [
|
||||
Request::HEADER_FORWARDED => 'FORWARDED',
|
||||
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
|
||||
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
|
||||
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
|
||||
Request::HEADER_FORWARDED => 'FORWARDED',
|
||||
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
|
||||
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
|
||||
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
|
||||
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Failed;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogFailedLogin
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogFailedLogin
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Failed $event
|
||||
* @param Failed $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Failed $event)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Lockout;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogLockout
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogLockout
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Lockout $event
|
||||
* @param Lockout $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Lockout $event)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogPasswordReset
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogPasswordReset
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param PasswordReset $event
|
||||
* @param PasswordReset $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(PasswordReset $event)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogRegisteredUser
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogRegisteredUser
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Registered $event
|
||||
* @param Registered $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Registered $event)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Login;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogSuccessfulLogin
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogSuccessfulLogin
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Login $event
|
||||
* @param Login $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Login $event)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Logout;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class LogSuccessfulLogout
|
||||
{
|
||||
@@ -21,7 +19,8 @@ class LogSuccessfulLogout
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Logout $event
|
||||
* @param Logout $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Logout $event)
|
||||
|
||||
@@ -7,10 +7,9 @@ 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.
|
||||
*/
|
||||
/**
|
||||
* From Name: name that will appear in the From field when a customer views your email.
|
||||
*/
|
||||
const FROM_NAME_MAILBOX = 1;
|
||||
const FROM_NAME_USER = 2;
|
||||
const FROM_NAME_CUSTOM = 3;
|
||||
@@ -23,29 +22,29 @@ 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;
|
||||
const OUT_METHOD_SMTP = 3;
|
||||
//const OUT_METHOD_GMAIL = 3; // todo
|
||||
// todo: mailgun, sendgrid, mandrill, etc
|
||||
|
||||
|
||||
/**
|
||||
* Secure Connection
|
||||
* Secure Connection.
|
||||
*/
|
||||
const OUT_SSL_NONE = 1;
|
||||
const OUT_SSL_SSL = 2;
|
||||
@@ -58,23 +57,23 @@ 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'];
|
||||
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'];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
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()
|
||||
{
|
||||
@@ -99,8 +98,8 @@ class Mailbox extends Model
|
||||
|
||||
/**
|
||||
* Create personal folders for users.
|
||||
*
|
||||
* @param mixed $users
|
||||
*
|
||||
* @param mixed $users
|
||||
*/
|
||||
public function syncPersonalFolders($users)
|
||||
{
|
||||
@@ -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,11 +204,10 @@ class Mailbox extends Model
|
||||
{
|
||||
$folders = $this->folders;
|
||||
foreach ($folders as $folder) {
|
||||
|
||||
$folder->active_count = $folder->conversations()
|
||||
->where('status', Conversation::STATUS_ACTIVE)
|
||||
->count();
|
||||
|
||||
|
||||
$folder->total_count = $folder->conversations()->count();
|
||||
|
||||
$folder->save();
|
||||
@@ -218,18 +216,18 @@ 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()
|
||||
{
|
||||
@@ -242,8 +240,8 @@ class Mailbox extends Model
|
||||
|
||||
/**
|
||||
* Is sending emails configured for the mailbox.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOutActive()
|
||||
{
|
||||
|
||||
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MailboxUser extends Model
|
||||
{
|
||||
protected $table = 'mailbox_user';
|
||||
protected $table = 'mailbox_user';
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ class ConversationObserver
|
||||
{
|
||||
/**
|
||||
* On create.
|
||||
*
|
||||
* @param Conversation $conversation
|
||||
*
|
||||
* @param Conversation $conversation
|
||||
*/
|
||||
public function created(Conversation $conversation)
|
||||
{
|
||||
@@ -18,11 +18,11 @@ class ConversationObserver
|
||||
|
||||
/**
|
||||
* On conversation delete.
|
||||
*
|
||||
* @param Conversation $conversation
|
||||
*
|
||||
* @param Conversation $conversation
|
||||
*/
|
||||
public function deleting(Conversation $conversation)
|
||||
{
|
||||
$conversation->threads()->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Mailbox;
|
||||
use App\Folder;
|
||||
use App\Conversation;
|
||||
use App\Mailbox;
|
||||
|
||||
class MailboxObserver
|
||||
{
|
||||
/**
|
||||
* Listen to the Mailbox created event.
|
||||
*
|
||||
* @param \App\Mailbox $mailbox
|
||||
* @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,10 +29,11 @@ class MailboxObserver
|
||||
* Delete the following on mailbox delete:
|
||||
* - folders
|
||||
* - conversations
|
||||
* - user permissions
|
||||
*
|
||||
* @param Mailbox $mailbox
|
||||
* @return [type] [description]
|
||||
* - user permissions.
|
||||
*
|
||||
* @param Mailbox $mailbox
|
||||
*
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function deleting(Mailbox $mailbox)
|
||||
{
|
||||
@@ -40,4 +41,4 @@ class MailboxObserver
|
||||
$mailbox->conversations()->delete();
|
||||
$mailbox->folders()->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@ class ThreadObserver
|
||||
{
|
||||
/**
|
||||
* Thread created.
|
||||
*
|
||||
* @param Thread $thread
|
||||
*
|
||||
* @param Thread $thread
|
||||
*/
|
||||
public function created(Thread $thread)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@ class UserObserver
|
||||
{
|
||||
/**
|
||||
* On user delete.
|
||||
*
|
||||
* @param Conversation $mailbox
|
||||
* @return [type] [description]
|
||||
*
|
||||
* @param Conversation $mailbox
|
||||
*
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function deleting(User $user)
|
||||
{
|
||||
$user->folders()->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\User;
|
||||
use App\Conversation;
|
||||
use App\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ConversationPolicy
|
||||
@@ -13,8 +13,9 @@ class ConversationPolicy
|
||||
/**
|
||||
* Determine whether the user can view the conversation.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\Conversation $conversation
|
||||
* @param \App\User $user
|
||||
* @param \App\Conversation $conversation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function view(User $user, Conversation $conversation)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\User;
|
||||
use App\Folder;
|
||||
use App\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class FolderPolicy
|
||||
@@ -13,8 +13,9 @@ class FolderPolicy
|
||||
/**
|
||||
* Determine whether the user can view the folder.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\Folder $folder
|
||||
* @param \App\User $user
|
||||
* @param \App\Folder $folder
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function view(User $user, Folder $folder)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\User;
|
||||
use App\Mailbox;
|
||||
use App\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class MailboxPolicy
|
||||
@@ -13,7 +13,8 @@ class MailboxPolicy
|
||||
/**
|
||||
* Determine whether the user can create mailboxes.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\User $user
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(User $user)
|
||||
@@ -28,8 +29,9 @@ class MailboxPolicy
|
||||
/**
|
||||
* Determine whether the user can update the mailbox.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\Mailbox $mailbox
|
||||
* @param \App\User $user
|
||||
* @param \App\Mailbox $mailbox
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(User $user, Mailbox $mailbox)
|
||||
@@ -44,8 +46,9 @@ class MailboxPolicy
|
||||
/**
|
||||
* Determine whether the user can delete the mailbox.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\Mailbox $mailbox
|
||||
* @param \App\User $user
|
||||
* @param \App\Mailbox $mailbox
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete(User $user, Mailbox $mailbox)
|
||||
|
||||
@@ -12,8 +12,9 @@ class UserPolicy
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function view(User $user, User $model)
|
||||
@@ -28,7 +29,8 @@ class UserPolicy
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\User $user
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(User $user)
|
||||
@@ -43,8 +45,9 @@ class UserPolicy
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(User $user, User $model)
|
||||
@@ -59,8 +62,9 @@ class UserPolicy
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
* @param \App\User $user
|
||||
* @param \App\User $model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete(User $user, User $model)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
@@ -13,9 +12,9 @@ class AuthServiceProvider extends ServiceProvider
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\User' => 'App\Policies\UserPolicy',
|
||||
'App\Mailbox' => 'App\Policies\MailboxPolicy',
|
||||
'App\Folder' => 'App\Policies\FolderPolicy',
|
||||
'App\User' => 'App\Policies\UserPolicy',
|
||||
'App\Mailbox' => 'App\Policies\MailboxPolicy',
|
||||
'App\Folder' => 'App\Policies\FolderPolicy',
|
||||
'App\Conversation' => 'App\Policies\ConversationPolicy',
|
||||
];
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -16,7 +16,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
'Illuminate\Auth\Events\Registered' => [
|
||||
'App\Listeners\LogRegisteredUser',
|
||||
],
|
||||
|
||||
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\LogSuccessfulLogin',
|
||||
],
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
128
app/Thread.php
128
app/Thread.php
@@ -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',
|
||||
);
|
||||
self::PERSON_USER => 'user',
|
||||
];
|
||||
|
||||
/**
|
||||
* Thread types
|
||||
* Thread types.
|
||||
*/
|
||||
// Email from customer
|
||||
const TYPE_CUSTOMER = 1;
|
||||
@@ -35,23 +35,23 @@ class Thread extends Model
|
||||
|
||||
public static $types = [
|
||||
// Thread by customer
|
||||
self::TYPE_CUSTOMER => 'customer',
|
||||
self::TYPE_CUSTOMER => 'customer',
|
||||
// Thread by user
|
||||
self::TYPE_MESSAGE => 'message',
|
||||
self::TYPE_NOTE => 'note',
|
||||
self::TYPE_MESSAGE => 'message',
|
||||
self::TYPE_NOTE => 'note',
|
||||
// lineitem represents a change of state on the conversation. This could include, but not limited to, the conversation was assigned, the status changed, the conversation was moved from one mailbox to another, etc. A line item won’t have a body, to/cc/bcc lists, or attachments.
|
||||
self::TYPE_LINEITEM => 'lineitem',
|
||||
self::TYPE_PHONE => 'phone',
|
||||
self::TYPE_LINEITEM => 'lineitem',
|
||||
self::TYPE_PHONE => 'phone',
|
||||
// When a conversation is forwarded, a new conversation is created to represent the forwarded conversation.
|
||||
// forwardparent is the type set on the thread of the original conversation that initiated the forward event.
|
||||
self::TYPE_FORWARDPARENT => 'forwardparent',
|
||||
self::TYPE_FORWARDPARENT => 'forwardparent',
|
||||
// forwardchild is the type set on the first thread of the new forwarded conversation.
|
||||
self::TYPE_FORWARDCHILD => 'forwardchild',
|
||||
self::TYPE_CHAT => 'chat',
|
||||
self::TYPE_FORWARDCHILD => 'forwardchild',
|
||||
self::TYPE_CHAT => 'chat',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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(
|
||||
self::STATUS_ACTIVE => 'active',
|
||||
self::STATUS_CLOSED => 'closed',
|
||||
self::STATUS_NOCHANGE => 'nochange',
|
||||
self::STATUS_PENDING => 'pending',
|
||||
self::STATUS_SPAM => 'spam',
|
||||
);
|
||||
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(
|
||||
self::STATE_DRAFT => 'draft',
|
||||
self::STATE_PUBLISHED => 'published',
|
||||
self::STATE_HIDDEN => 'hidden',
|
||||
self::STATE_REVIEW => 'review',
|
||||
);
|
||||
|
||||
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;
|
||||
@@ -106,32 +106,32 @@ class Thread extends Model
|
||||
// Describes an optional action associated with the line item
|
||||
// todo: values need to be checked via HelpScout API
|
||||
public static $action_types = [
|
||||
self::ACTION_TYPE_MOVED_FROM_MAILBOX => 'moved-from-mailbox',
|
||||
self::ACTION_TYPE_MERGED => 'merged',
|
||||
self::ACTION_TYPE_IMPORTED => 'imported',
|
||||
self::ACTION_TYPE_WORKFLOW_MANUAL => 'manual-workflow',
|
||||
self::ACTION_TYPE_WORKFLOW_AUTO => 'automatic-workflow',
|
||||
self::ACTION_TYPE_IMPORTED_EXTERNAL => 'imported-external',
|
||||
self::ACTION_TYPE_CHANGED_TICKET_CUSTOMER => 'changed-ticket-customer',
|
||||
self::ACTION_TYPE_DELETED_TICKET => 'deleted-ticket',
|
||||
self::ACTION_TYPE_RESTORE_TICKET => 'restore-ticket',
|
||||
self::ACTION_TYPE_MOVED_FROM_MAILBOX => 'moved-from-mailbox',
|
||||
self::ACTION_TYPE_MERGED => 'merged',
|
||||
self::ACTION_TYPE_IMPORTED => 'imported',
|
||||
self::ACTION_TYPE_WORKFLOW_MANUAL => 'manual-workflow',
|
||||
self::ACTION_TYPE_WORKFLOW_AUTO => 'automatic-workflow',
|
||||
self::ACTION_TYPE_IMPORTED_EXTERNAL => 'imported-external',
|
||||
self::ACTION_TYPE_CHANGED_TICKET_CUSTOMER => 'changed-ticket-customer',
|
||||
self::ACTION_TYPE_DELETED_TICKET => 'deleted-ticket',
|
||||
self::ACTION_TYPE_RESTORE_TICKET => 'restore-ticket',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 = [
|
||||
self::SOURCE_TYPE_EMAIL => 'email',
|
||||
self::SOURCE_TYPE_WEB => 'web',
|
||||
self::SOURCE_TYPE_API => 'api',
|
||||
self::SOURCE_TYPE_EMAIL => 'email',
|
||||
self::SOURCE_TYPE_WEB => 'web',
|
||||
self::SOURCE_TYPE_API => 'api',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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()
|
||||
@@ -173,7 +174,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTos()
|
||||
@@ -187,7 +188,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread CC recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCcs()
|
||||
@@ -201,7 +202,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread BCC recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBccs()
|
||||
@@ -215,31 +216,32 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get status name. Made as a function to allow status names translation.
|
||||
*
|
||||
* @param integer $status
|
||||
* @return string
|
||||
*
|
||||
* @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:
|
||||
|
||||
112
app/User.php
112
app/User.php
@@ -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,41 +19,41 @@ 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;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are not mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = ['role'];
|
||||
protected $guarded = ['role'];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays, excluded from the model's JSON form.
|
||||
@@ -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'];
|
||||
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,8 +96,8 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user role
|
||||
*
|
||||
* Get user role.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleName($ucfirst = false)
|
||||
@@ -105,30 +106,32 @@ class User extends Authenticatable
|
||||
if ($ucfirst) {
|
||||
$role_name = ucfirst($role_name);
|
||||
}
|
||||
|
||||
return $role_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is admin
|
||||
*
|
||||
* @return boolean
|
||||
* Check if user is admin.
|
||||
*
|
||||
* @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()
|
||||
@@ -161,9 +168,9 @@ class User extends Authenticatable
|
||||
|
||||
/**
|
||||
* Create personal folders for user mailboxes.
|
||||
*
|
||||
* @param integer $mailbox_id
|
||||
* @param mixed $users
|
||||
*
|
||||
* @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;
|
||||
@@ -196,10 +203,11 @@ class User extends Authenticatable
|
||||
|
||||
/**
|
||||
* Format date according to user's timezone and time format.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param string $format
|
||||
* @return string
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param string $format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dateFormat($date, $format)
|
||||
{
|
||||
@@ -207,16 +215,16 @@ class User extends Authenticatable
|
||||
if ($user) {
|
||||
if ($user->time_format == self::TIME_FORMAT_12) {
|
||||
$format = strtr($format, [
|
||||
'H' => 'h',
|
||||
'G' => 'g',
|
||||
':i' => ':ia',
|
||||
'H' => 'h',
|
||||
'G' => 'g',
|
||||
':i' => ':ia',
|
||||
':ia:s' => ':i:sa',
|
||||
]);
|
||||
} else {
|
||||
$format = strtr($format, [
|
||||
'h' => 'H',
|
||||
'g' => 'G',
|
||||
':ia' => ':i',
|
||||
'h' => 'H',
|
||||
'g' => 'G',
|
||||
':ia' => ':i',
|
||||
':i:sa' => ':i:s',
|
||||
]);
|
||||
}
|
||||
@@ -230,8 +238,9 @@ class User extends Authenticatable
|
||||
|
||||
/**
|
||||
* Convert date into human readable format.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,40 +213,40 @@ return [
|
||||
|
||||
'aliases' => [
|
||||
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||
'Request' => Illuminate\Support\Facades\Request::class,
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'Minify' => Devfactory\Minify\Facades\MinifyFacade::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||
'Request' => Illuminate\Support\Facades\Request::class,
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'Minify' => Devfactory\Minify\Facades\MinifyFacade::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -14,7 +14,7 @@ return [
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
@@ -37,12 +37,12 @@ return [
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'driver' => 'token',
|
||||
'driver' => 'token',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
@@ -67,7 +67,7 @@ return [
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\User::class,
|
||||
'model' => App\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
@@ -94,8 +94,8 @@ return [
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
@@ -31,18 +31,18 @@ return [
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'encrypted' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
|
||||
@@ -39,20 +39,20 @@ return [
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
@@ -61,15 +61,15 @@ return [
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
|
||||
@@ -34,24 +34,24 @@ return [
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'driver' => 'sqlite',
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
],
|
||||
|
||||
'testing' => [
|
||||
@@ -67,27 +67,27 @@ return [
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'driver' => 'sqlsrv',
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
],
|
||||
@@ -121,9 +121,9 @@ return [
|
||||
'client' => 'predis',
|
||||
|
||||
'default' => [
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
'database' => 0,
|
||||
],
|
||||
|
||||
|
||||
@@ -45,19 +45,19 @@ return [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
|
||||
@@ -57,7 +57,7 @@ return [
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -24,9 +24,9 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'ignore_environments' => array(
|
||||
'local',
|
||||
),
|
||||
'ignore_environments' => [
|
||||
'local',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -41,7 +41,7 @@ return array(
|
||||
*/
|
||||
|
||||
'css_build_path' => '/css/builds/',
|
||||
'css_url_path' => '/css/builds/',
|
||||
'css_url_path' => '/css/builds/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -56,22 +56,22 @@ return array(
|
||||
*/
|
||||
|
||||
'js_build_path' => '/js/builds/',
|
||||
'js_url_path' => '/js/builds/',
|
||||
'js_url_path' => '/js/builds/',
|
||||
|
||||
/*
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Hash modification
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can disable usage of modification time (mtime) for hash build and
|
||||
| add additional salt (exp. commit hash) for hash build
|
||||
| add additional salt (exp. commit hash) for hash build
|
||||
|
|
||||
*/
|
||||
|
||||
'disable_mtime' => false,
|
||||
'hash_salt' => '',
|
||||
'hash_salt' => '',
|
||||
|
||||
/*
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Base URL
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -80,5 +80,5 @@ return array(
|
||||
| value. By default if empty HTTP_HOST would be used.
|
||||
|
|
||||
*/
|
||||
'base_url' => ''
|
||||
);
|
||||
'base_url' => '',
|
||||
];
|
||||
|
||||
@@ -35,32 +35,32 @@ return [
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('SQS_KEY', 'your-public-key'),
|
||||
'key' => env('SQS_KEY', 'your-public-key'),
|
||||
'secret' => env('SQS_SECRET', 'your-secret-key'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'your-queue-name'),
|
||||
'queue' => env('SQS_QUEUE', 'your-queue-name'),
|
||||
'region' => env('SQS_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => 'default',
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
@@ -79,7 +79,7 @@ return [
|
||||
|
||||
'failed' => [
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ return [
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('SES_KEY'),
|
||||
'key' => env('SES_KEY'),
|
||||
'secret' => env('SES_SECRET'),
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
@@ -30,8 +30,8 @@ return [
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => App\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'model' => App\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
],
|
||||
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?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 {
|
||||
// Pick random user
|
||||
$created_by = App\User::inRandomOrder()->first()->id;
|
||||
}
|
||||
$folder_id = null;
|
||||
if (!empty($params['folder_id'])) {
|
||||
$folder_id = $params['folder_id'];
|
||||
} elseif (!empty($params['mailbox_id'])) {
|
||||
// Pick folder
|
||||
$folder = App\Folder::where(['mailbox_id' => $params['mailbox_id'], 'type' => App\Folder::TYPE_UNASSIGNED])->first();
|
||||
if ($folder) {
|
||||
$folder_id = $folder->id;
|
||||
} else {
|
||||
$folder_id = factory(App\Folder::class)->create()->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['created_by'])) {
|
||||
$created_by = $params['created_by'];
|
||||
} else {
|
||||
// Pick random user
|
||||
$created_by = App\User::inRandomOrder()->first()->id;
|
||||
}
|
||||
$folder_id = null;
|
||||
if (!empty($params['folder_id'])) {
|
||||
$folder_id = $params['folder_id'];
|
||||
} elseif (!empty($params['mailbox_id'])) {
|
||||
// Pick folder
|
||||
$folder = App\Folder::where(['mailbox_id' => $params['mailbox_id'], 'type' => App\Folder::TYPE_UNASSIGNED])->first();
|
||||
if ($folder) {
|
||||
$folder_id = $folder->id;
|
||||
} else {
|
||||
$folder_id = factory(App\Folder::class)->create()->id;
|
||||
}
|
||||
}
|
||||
return [
|
||||
'type' => $faker->randomElement([Conversation::TYPE_EMAIL, Conversation::TYPE_PHONE]),
|
||||
'type' => $faker->randomElement([Conversation::TYPE_EMAIL, Conversation::TYPE_PHONE]),
|
||||
'folder_id' => $folder_id,
|
||||
'state' => $faker->randomElement(array_keys(Conversation::$states)),
|
||||
'subject' => $faker->sentence(7),
|
||||
'state' => $faker->randomElement(array_keys(Conversation::$states)),
|
||||
'subject' => $faker->sentence(7),
|
||||
// todo: cc and bcc must be equal to first (or last?) thread of conversation
|
||||
'cc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'bcc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'preview' => $faker->text(Conversation::PREVIEW_MAXLENGTH),
|
||||
'imported' => true,
|
||||
'created_by' => $created_by,
|
||||
'source_via' => Conversation::PERSON_CUSTOMER,
|
||||
'cc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'bcc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'preview' => $faker->text(Conversation::PREVIEW_MAXLENGTH),
|
||||
'imported' => true,
|
||||
'created_by' => $created_by,
|
||||
'source_via' => Conversation::PERSON_CUSTOMER,
|
||||
'source_type' => Conversation::SOURCE_TYPE_EMAIL,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -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]])
|
||||
'last_name' => $faker->lastName,
|
||||
'job_title' => $faker->jobTitle,
|
||||
'phones' => Customer::formatPhones([['value' => $faker->phoneNumber, 'type' => Customer::PHONE_TYPE_WORK]]),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
<?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;
|
||||
if (!empty($params['mailbox_id'])) {
|
||||
$mailbox_id = $params['mailbox_id'];
|
||||
} else {
|
||||
$mailbox = App\Mailbox::inRandomOrder()->first();
|
||||
if ($mailbox) {
|
||||
$mailbox_id = $mailbox->id;
|
||||
}
|
||||
}
|
||||
$mailbox_id = null;
|
||||
if (!empty($params['mailbox_id'])) {
|
||||
$mailbox_id = $params['mailbox_id'];
|
||||
} else {
|
||||
$mailbox = App\Mailbox::inRandomOrder()->first();
|
||||
if ($mailbox) {
|
||||
$mailbox_id = $mailbox->id;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'mailbox_id' => $mailbox_id,
|
||||
'type' => Folder::TYPE_UNASSIGNED,
|
||||
'type' => Folder::TYPE_UNASSIGNED,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Mailbox::class, function (Faker $faker) {
|
||||
$name = $faker->company;
|
||||
$email = $faker->unique()->companyEmail;
|
||||
$domain = explode('@', $email)[1];
|
||||
$name = $faker->company;
|
||||
$email = $faker->unique()->companyEmail;
|
||||
$domain = explode('@', $email)[1];
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'aliases' => 'support@'.$domain.',help@'.$domain.', contact@'.$domain,
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'aliases' => 'support@'.$domain.',help@'.$domain.', contact@'.$domain,
|
||||
'signature' => '--<br/>'.$name,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
<?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 {
|
||||
// Pick random customer
|
||||
//$customer_id = $faker->randomElement(App\Customer::pluck('id')->toArray());
|
||||
$customer = User::inRandomOrder()->first();
|
||||
if (!$customer) {
|
||||
$customer = factory(App\Customer::class)->create();
|
||||
}
|
||||
$customer_id = $customer->id;
|
||||
}
|
||||
if (!empty($params['to'])) {
|
||||
$to = $params['to'];
|
||||
} elseif ($customer) {
|
||||
$to = $customer->getMainEmail();
|
||||
} else {
|
||||
$to = json_encode([$faker->unique()->safeEmail]);
|
||||
}
|
||||
|
||||
if (!empty($params['customer_id'])) {
|
||||
$customer_id = $params['customer_id'];
|
||||
} else {
|
||||
// Pick random customer
|
||||
//$customer_id = $faker->randomElement(App\Customer::pluck('id')->toArray());
|
||||
$customer = User::inRandomOrder()->first();
|
||||
if (!$customer) {
|
||||
$customer = factory(App\Customer::class)->create();
|
||||
}
|
||||
$customer_id = $customer->id;
|
||||
}
|
||||
if (!empty($params['to'])) {
|
||||
$to = $params['to'];
|
||||
} elseif ($customer) {
|
||||
$to = $customer->getMainEmail();
|
||||
} else {
|
||||
$to = json_encode([$faker->unique()->safeEmail]);
|
||||
}
|
||||
return [
|
||||
'type' => Thread::TYPE_CUSTOMER,
|
||||
//'conversation_id' => ,
|
||||
'customer_id' => $customer_id,
|
||||
'state' => Thread::STATE_PUBLISHED,
|
||||
'body' => $faker->text(500),
|
||||
'to' => $to,
|
||||
'cc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'bcc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'source_via' => Thread::PERSON_CUSTOMER,
|
||||
'state' => Thread::STATE_PUBLISHED,
|
||||
'body' => $faker->text(500),
|
||||
'to' => $to,
|
||||
'cc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'bcc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'source_via' => Thread::PERSON_CUSTOMER,
|
||||
'source_type' => Thread::SOURCE_TYPE_EMAIL,
|
||||
'created_by' => $customer_id,
|
||||
'created_by' => $customer_id,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -15,12 +15,12 @@ use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\User::class, function (Faker $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'job_title' => $faker->jobTitle,
|
||||
'phone' => $faker->phoneNumber,
|
||||
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'job_title' => $faker->jobTitle,
|
||||
'phone' => $faker->phoneNumber,
|
||||
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
|
||||
'remember_token' => str_random(10),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateActivityLogTable extends Migration
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -29,8 +29,8 @@ class CreateConversationsTable extends Migration
|
||||
$table->text('cc')->nullable(); // JSON
|
||||
$table->text('bcc')->nullable(); // JSON
|
||||
$table->string('preview', Conversation::PREVIEW_MAXLENGTH);
|
||||
// The imported field enables conversation to be created for historical purposes
|
||||
// (i.e. if moving from a different platform, you can import your history).
|
||||
// The imported field enables conversation to be created for historical purposes
|
||||
// (i.e. if moving from a different platform, you can import your history).
|
||||
// When imported is set to true, no outgoing emails or notifications will be generated.
|
||||
$table->boolean('imported')->default(false);
|
||||
$table->boolean('has_attachments')->default(false);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ class CustomersTableSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
factory(App\Customer::class, 5)->create()->each(function ($m) {
|
||||
$m->emails()->save(factory(App\Email::class)->make());
|
||||
$m->emails()->save(factory(App\Email::class)->make());
|
||||
});
|
||||
$m->emails()->save(factory(App\Email::class)->make());
|
||||
$m->emails()->save(factory(App\Email::class)->make());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Conversation;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -17,10 +17,9 @@ 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());
|
||||
|
||||
$conversation = factory(App\Conversation::class)->create(['created_by' => $user->id, 'mailbox_id' => $m->id, 'customer_id' => $customer->id, 'user_id' => $user->id, 'status' => array_rand([Conversation::STATUS_ACTIVE => 1, Conversation::STATUS_PENDING => 1])]);
|
||||
|
||||
@@ -11,6 +11,6 @@ class MailboxesTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\Mailbox::class, 3)->create();
|
||||
factory(App\Mailbox::class, 3)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
/*
|
||||
|
||||
@@ -13,7 +13,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
|
||||
];
|
||||
|
||||
@@ -14,6 +14,6 @@ return [
|
||||
*/
|
||||
|
||||
'previous' => '« Previous',
|
||||
'next' => 'Next »',
|
||||
'next' => 'Next »',
|
||||
|
||||
];
|
||||
|
||||
@@ -14,9 +14,9 @@ return [
|
||||
*/
|
||||
|
||||
'password' => 'Passwords must be at least six characters and match the confirmation.',
|
||||
'reset' => 'Your password has been reset!',
|
||||
'sent' => 'We have e-mailed your password reset link!',
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'user' => "We can't find a user with that e-mail address.",
|
||||
'reset' => 'Your password has been reset!',
|
||||
'sent' => 'We have e-mailed your password reset link!',
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'user' => "We can't find a user with that e-mail address.",
|
||||
|
||||
];
|
||||
|
||||
@@ -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
|
||||
Route::get('/conversation/{id}', 'ConversationsController@view')->name('conversations.view');
|
||||
// Conversations
|
||||
Route::get('/conversation/{id}', 'ConversationsController@view')->name('conversations.view');
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
trait CreatesApplication
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user