mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-25 11:52:29 +01:00
Merge pull request #16 from freescout-helpdesk/analysis-8wZkPW
Apply fixes from StyleCI
This commit is contained in:
commit
b7ce8b58de
@ -3,7 +3,6 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Folder;
|
||||
|
||||
class Conversation extends Model
|
||||
{
|
||||
@ -189,7 +188,7 @@ class Conversation extends Model
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set preview text.
|
||||
*
|
||||
@ -271,8 +270,8 @@ class Conversation extends Model
|
||||
|
||||
/**
|
||||
* Set conersation status and all related fields.
|
||||
*
|
||||
* @param integer $status
|
||||
*
|
||||
* @param int $status
|
||||
*/
|
||||
public function setStatus($status, $user = null)
|
||||
{
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Conversation;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Events\ConversationStatusChanged;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ConversationsController extends Controller
|
||||
{
|
||||
|
@ -3,8 +3,6 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ConversationStatusChanged;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Thread;
|
||||
|
||||
class CreateThreadStatusChanged
|
||||
@ -22,7 +20,8 @@ class CreateThreadStatusChanged
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param ConversationStatusChanged $event
|
||||
* @param ConversationStatusChanged $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ConversationStatusChanged $event)
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class UpdateMailboxCounters
|
||||
{
|
||||
/**
|
||||
@ -21,6 +18,7 @@ class UpdateMailboxCounters
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
|
134
app/Thread.php
134
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.
|
||||
*/
|
||||
// Conversation's status changed
|
||||
const ACTION_TYPE_STATUS_CHANGED = 1;
|
||||
@ -110,34 +110,34 @@ 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_STATUS_CHANGED => 'changed-ticket-status',
|
||||
self::ACTION_TYPE_USER_CHANGED => 'changed-ticket-assignee',
|
||||
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_STATUS_CHANGED => 'changed-ticket-status',
|
||||
self::ACTION_TYPE_USER_CHANGED => 'changed-ticket-assignee',
|
||||
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;
|
||||
@ -145,7 +145,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()
|
||||
{
|
||||
@ -153,7 +153,7 @@ class Thread extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the thread customer
|
||||
* Get the thread customer.
|
||||
*/
|
||||
public function customer()
|
||||
{
|
||||
@ -161,7 +161,7 @@ class Thread extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversation
|
||||
* Get conversation.
|
||||
*/
|
||||
public function conversation()
|
||||
{
|
||||
@ -185,7 +185,8 @@ class Thread extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sanitized body HTML
|
||||
* Get sanitized body HTML.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCleanBody()
|
||||
@ -195,7 +196,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTos()
|
||||
@ -209,7 +210,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread CC recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCcs()
|
||||
@ -223,7 +224,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread BCC recipients.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBccs()
|
||||
@ -237,7 +238,7 @@ class Thread extends Model
|
||||
|
||||
/**
|
||||
* Get thread's status name.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusName()
|
||||
@ -247,31 +248,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 statusCodeToName($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:
|
||||
|
114
app/User.php
114
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)
|
||||
@ -239,24 +248,25 @@ class User extends Authenticatable
|
||||
if (!$date) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$user = auth()->user();
|
||||
if ($user) {
|
||||
$date->setTimezone($user->timezone);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ $factory->define(Conversation::class, function (Faker $faker, $params) {
|
||||
'state' => Conversation::STATE_PUBLISHED, // $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,
|
||||
'cc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'bcc' => json_encode([$faker->unique()->safeEmail]),
|
||||
'preview' => $faker->text(Conversation::PREVIEW_MAXLENGTH),
|
||||
'imported' => true,
|
||||
'created_by_user_id' => $created_by_user_id,
|
||||
'source_via' => Conversation::PERSON_CUSTOMER,
|
||||
'source_type' => Conversation::SOURCE_TYPE_EMAIL,
|
||||
'source_via' => Conversation::PERSON_CUSTOMER,
|
||||
'source_type' => Conversation::SOURCE_TYPE_EMAIL,
|
||||
];
|
||||
});
|
||||
|
@ -26,14 +26,14 @@ $factory->define(Thread::class, function (Faker $faker, $params) {
|
||||
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,
|
||||
'source_type' => Thread::SOURCE_TYPE_EMAIL,
|
||||
'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,
|
||||
'source_type' => Thread::SOURCE_TYPE_EMAIL,
|
||||
'created_by_customer_id' => $customer_id,
|
||||
];
|
||||
});
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user