Review, publish, preview and undo changes through the API
Revisions now call publishing only what publishes: a project's status is whether the work is active, and a service is published by its flag. The fake identity server answers by token, so a test can sign in a second person. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
29
app/Http/Controllers/Api/V1/Concerns/ResolvesContent.php
Normal file
29
app/Http/Controllers/Api/V1/Concerns/ResolvesContent.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Concerns;
|
||||
|
||||
use App\Support\AdminContent;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* For the endpoints shared by several kinds of content —
|
||||
* `/pages/{page}/revisions`, `/projects/{project}/revisions` — whose route
|
||||
* says which kind through its `content` default.
|
||||
*/
|
||||
trait ResolvesContent
|
||||
{
|
||||
protected function content(Request $request): string
|
||||
{
|
||||
return (string) $request->route('content');
|
||||
}
|
||||
|
||||
protected function record(Request $request): Model
|
||||
{
|
||||
$content = $this->content($request);
|
||||
|
||||
return AdminContent::find($content, $request->route(AdminContent::parameter($content)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user