Skip to content

Commit

Permalink
updated tasks created at and updated at
Browse files Browse the repository at this point in the history
  • Loading branch information
neshanth committed Sep 21, 2024
1 parent 5dab9f3 commit 4f99e56
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 17 deletions.
63 changes: 47 additions & 16 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,107 +29,138 @@ protected function schedule(Schedule $schedule)
'due_date' => now()->addDays(2)->toDateString(),
'status' => 0,
'task' => 'Project Review',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Complete the database migration script',
'due_date' => now()->addDays(4)->toDateString(),
'status' => 0,
'task' => 'Database Migration',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Go grocery shopping for the week',
'due_date' => now()->addDays(1)->toDateString(),
'status' => 0,
'task' => 'Grocery Shopping',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Prepare presentation for client meeting',
'due_date' => now()->addDays(3)->toDateString(),
'status' => 0,
'task' => 'Client Presentation',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Attend yoga class',
'due_date' => now()->addDays(2)->toDateString(),
'status' => 0,
'task' => 'Yoga Session',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Respond to pending emails',
'due_date' => now()->addDays(1)->toDateString(),
'status' => 0,
'task' => 'Email Follow-up',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Book flight tickets for vacation',
'due_date' => now()->addDays(7)->toDateString(),
'status' => 0,
'task' => 'Book Flight Tickets',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Fix bug in user login system',
'due_date' => now()->addDays(2)->toDateString(),
'status' => 0,
'task' => 'Bug Fix: User Login',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Schedule team stand-up meeting',
'due_date' => now()->addDays(1)->toDateString(),
'status' => 0,
'task' => 'Team Stand-up',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Buy birthday gift for friend',
'due_date' => now()->addDays(5)->toDateString(),
'status' => 0,
'task' => 'Friend\'s Birthday Gift',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Plan weekend getaway',
'due_date' => now()->addDays(6)->toDateString(),
'status' => 0,
'task' => 'Weekend Getaway',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Design homepage layout',
'due_date' => now()->addDays(3)->toDateString(),
'status' => 0,
'task' => 'Homepage Design',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Complete quarterly budget review',
'due_date' => now()->addDays(2)->toDateString(),
'status' => 0,
'task' => 'Budget Review',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Call plumber for kitchen sink repair',
'due_date' => now()->addDays(4)->toDateString(),
'status' => 0,
'task' => 'Call Plumber',
'user_id' => $userId
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
[
'description' => 'Watch the new movie release',
'due_date' => now()->addDays(3)->toDateString(),
'status' => 0,
'task' => 'Movie Night',
'user_id' => $userId
]
'user_id' => $userId,
'created_at' => now(),
'updated_at' => now(),
],
];

DB::table('tasks')->insert($tasks);
}
})->daily();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Task/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TaskController extends Controller
public function index(Request $request)
{
$userId = $request->user()->id;
$tasks = Task::where("user_id", "=", $userId)->get();
$tasks = Task::where("user_id", "=", $userId)->orderBy('created_at', 'desc')->get();
foreach($tasks as $task){
$tagsArray = $this->getTagsByTask($task->id);
$task->tags = $tagsArray;
Expand Down
1 change: 1 addition & 0 deletions app/Models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Task extends Model
use HasFactory;

protected $fillable = ['task','description','due_date','status','user_id'];
public $timestamps = true;

public function tags()
{
Expand Down

0 comments on commit 4f99e56

Please sign in to comment.