Skip to content

Commit

Permalink
needs to be carbon
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Feb 27, 2025
1 parent ed1fcf9 commit 05546b1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Http/Controllers/CP/Collections/EntryRevisionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Http\Controllers\CP\Collections;

use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Statamic\Facades\Site;
use Statamic\Facades\User;
use Statamic\Http\Controllers\CP\CpController;
Expand Down Expand Up @@ -39,13 +40,16 @@ public function index(Request $request, $collection, $entry)

public function store(Request $request, $collection, $entry)
{
$entry->createRevision([
$data = [
'message' => $request->message,
'publish_at' => $request->publish_at,
'user' => User::fromUser($request->user()),
]);
];

if (! is_null($dateTime = $request->publish_at)) {
$data['publish_at'] = Carbon::parse($dateTime['date'].' '.$dateTime['time'] ?? '00:00');
}

return new EntryResource($entry);
return new EntryResource($entry->createRevision($data));
}

public function show(Request $request, $collection, $entry, $revision)
Expand Down

0 comments on commit 05546b1

Please sign in to comment.