mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Add columns for tasks
This commit is contained in:
parent
dfc2f9ffe2
commit
b2b8494971
@ -97,6 +97,16 @@ class TaskFilters extends QueryFilters
|
||||
return $this->builder->where('project_id', $this->decodePrimaryKey($project));
|
||||
}
|
||||
|
||||
public function hash(string $hash = ''): Builder
|
||||
{
|
||||
if (strlen($hash) == 0) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
return $this->builder->where('hash', $hash);
|
||||
|
||||
}
|
||||
|
||||
public function number(string $number = ''): Builder
|
||||
{
|
||||
if (strlen($number) == 0) {
|
||||
|
@ -54,6 +54,8 @@ class StoreTaskRequest extends Request
|
||||
$rules['project_id'] = 'bail|required|exists:projects,id,company_id,'.$user->company()->id.',is_deleted,0';
|
||||
}
|
||||
|
||||
$rules['hash'] = 'bail|sometimes|string|nullable';
|
||||
|
||||
$rules['time_log'] = ['bail',function ($attribute, $values, $fail) {
|
||||
|
||||
if(is_string($values)) {
|
||||
|
@ -60,6 +60,8 @@ class UpdateTaskRequest extends Request
|
||||
$rules['project_id'] = 'bail|required|exists:projects,id,company_id,'.$user->company()->id.',is_deleted,0';
|
||||
}
|
||||
|
||||
$rules['hash'] = 'bail|sometimes|string|nullable';
|
||||
|
||||
$rules['time_log'] = ['bail', function ($attribute, $values, $fail) {
|
||||
|
||||
if(is_string($values)) {
|
||||
|
@ -19,6 +19,8 @@ use Illuminate\Support\Carbon;
|
||||
* App\Models\Task
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $hash
|
||||
* @property object|null $meta
|
||||
* @property int $user_id
|
||||
* @property int|null $assigned_user_id
|
||||
* @property int $company_id
|
||||
@ -118,6 +120,15 @@ class Task extends BaseModel
|
||||
'number',
|
||||
'is_date_based',
|
||||
'status_order',
|
||||
'hash',
|
||||
'meta',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'meta' => 'object',
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
];
|
||||
|
||||
protected $touches = [];
|
||||
|
@ -71,4 +71,5 @@ class TaskStatus extends BaseModel
|
||||
'color',
|
||||
'status_order',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->string('hash')->nullable()->index();
|
||||
$table->text('meta')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user