NASER add taskززطزSQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION montask.ST_SetSRID does not exist (Connection: mysql, SQL: update ttendances set ip_exit = 51.684726144224, distance_exit = 850, exited_at = 2026-04-23 13:59:46, exit_location = ST_SetSRID(ST_Point(51.684726144224, 32.652053279154), 4326), duration = 04:59:46, ttendances.updated_at = 2026-04-23 13:59:46 where id = 937)
This commit is contained in:
Notes:
mobinesaghi
2026-04-23 14:42:21 +03:30
NASER add task functions undepended
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Console\View\Components\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class App extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'apps';
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'name_fa',
|
||||
'type',
|
||||
];
|
||||
|
||||
protected $TYPE = [
|
||||
1=>'خانگی',
|
||||
2=>'همکار'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskComment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'task_comments';
|
||||
|
||||
protected $fillable = [
|
||||
'task_id',
|
||||
'user_id',
|
||||
'body',
|
||||
'mentioned_user_ids',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'mentioned_user_ids' => 'array',
|
||||
];
|
||||
|
||||
public function task()
|
||||
{
|
||||
return $this->belongsTo(Tasks::class, 'task_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Console\View\Components\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class TaskDuration extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tasks_duration';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'task_id',
|
||||
'duration',
|
||||
'start',
|
||||
'end',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function task(){
|
||||
return $this->belongsTo(Tasks::class, 'task_id', 'id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
+19
-3
@@ -6,15 +6,16 @@ use Illuminate\Console\View\Components\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
|
||||
class Tasks extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory,SoftDeletes;
|
||||
|
||||
protected $table = 'tasks';
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'task_id',
|
||||
'title',
|
||||
@@ -65,6 +66,21 @@ class Tasks extends Model
|
||||
return $this->belogsTo(App::class);
|
||||
}
|
||||
|
||||
public function duration(){
|
||||
return $this->hasMany(TaskDuration::class, 'task_id', 'id');
|
||||
}
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(TaskComment::class, 'task_id', 'id')->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
public function userDurations($userId = null)
|
||||
{
|
||||
$userId = $userId ?: User::where('user_name', $_COOKIE['user_identity'])->first()->id; // پیشفرض: کاربر جاری
|
||||
return $this->taskDurations()->where('user_id', $userId);
|
||||
}
|
||||
|
||||
public function filterByState($tasks){
|
||||
$backlog = [];
|
||||
$todo = [];
|
||||
@@ -86,7 +102,7 @@ class Tasks extends Model
|
||||
'todo' => $todo,
|
||||
'inprogress' => $inprogress,
|
||||
'done' => $done,
|
||||
'count' => count($tasks),
|
||||
// 'count' => count($tasks),
|
||||
];
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -15,7 +16,7 @@ use Morilog\Jalali\Jalalian;
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
use HasFactory, Notifiable, softDeletes;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user