mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/tickme.git
synced 2026-08-19 04:23:56 +00:00
minor fixes
This commit is contained in:
@@ -16,17 +16,17 @@ class MilestoneTaskObject implements DataTransferObject
|
||||
/** @var string */
|
||||
private $title;
|
||||
|
||||
/** @var string */
|
||||
/** @var string|null */
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* MilestoneTaskObject constructor.
|
||||
* @param int $milestoneId
|
||||
* @param int $typeId
|
||||
* @param string $title
|
||||
* @param string $description
|
||||
* @param int $typeId
|
||||
* @param string $title
|
||||
* @param null|string $description
|
||||
*/
|
||||
public function __construct(int $milestoneId, int $typeId, string $title, string $description)
|
||||
public function __construct(int $milestoneId, int $typeId, string $title, ?string $description)
|
||||
{
|
||||
$this->milestoneId = $milestoneId;
|
||||
$this->typeId = $typeId;
|
||||
@@ -59,13 +59,12 @@ class MilestoneTaskObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDescription(): string
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class CommentResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'user' => new UserResource($this),
|
||||
'comment' => $this->pivot->comment,
|
||||
'comment' => nl2br($this->pivot->comment),
|
||||
'created_at' => carbon::parse($this->pivot->created_at)->diffForHumans()
|
||||
];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\EloquentSortable\Sortable;
|
||||
use Spatie\EloquentSortable\SortableTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
@@ -18,9 +20,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property string title
|
||||
* @property string description
|
||||
*/
|
||||
class MilestoneTask extends AbstractModel
|
||||
class MilestoneTask extends AbstractModel implements Sortable
|
||||
{
|
||||
|
||||
use SortableTrait;
|
||||
|
||||
public $sortable = [
|
||||
'order_column_name' => 'order',
|
||||
'sort_when_creating' => true,
|
||||
];
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
@@ -60,6 +69,11 @@ class MilestoneTask extends AbstractModel
|
||||
'title' => 'required'
|
||||
];
|
||||
|
||||
public function buildSortQuery()
|
||||
{
|
||||
return static::query()->where('milestone_id', $this->milestone_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
**/
|
||||
@@ -73,7 +87,7 @@ class MilestoneTask extends AbstractModel
|
||||
*/
|
||||
public function taskType(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(ModularType::class, 'type_id', 'id');
|
||||
return $this->BelongsTo(ModularType::class, 'type_id', 'id')->withTrashed();
|
||||
}
|
||||
|
||||
public function departments(){
|
||||
|
||||
Reference in New Issue
Block a user