wip
This commit is contained in:
parent
a89c2690a1
commit
0c2dcc62cb
@ -21,6 +21,7 @@ public function details()
|
|||||||
$this->decodeKeys();
|
$this->decodeKeys();
|
||||||
$study = Study::with(['series', 'details'])->findOrFail($this->key);
|
$study = Study::with(['series', 'details'])->findOrFail($this->key);
|
||||||
|
|
||||||
return view('staff.studies.details', compact('study'));
|
//return view('staff.studies.details', compact('study'));
|
||||||
|
return response()->json($study);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
app/Http/Requests/SharedStudyRequest.php
Normal file
20
app/Http/Requests/SharedStudyRequest.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class SharedStudyRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class StudyShareRequest extends FormRequest
|
|
||||||
{
|
|
||||||
public function rules(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'study_id' => ['required', 'exists:studies'],
|
|
||||||
'user_id' => ['required', 'exists:users'],
|
|
||||||
'operator_id' => ['nullable', 'exists:users'],
|
|
||||||
'expires_on' => ['nullable', 'date'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function authorize(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
20
app/Http/Resources/SharedStudyResource.php
Normal file
20
app/Http/Resources/SharedStudyResource.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use App\Models\SharedStudy;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/** @mixin SharedStudy */
|
||||||
|
class SharedStudyResource extends JsonResource
|
||||||
|
{
|
||||||
|
public function toArray(Request $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Enums\StudyAccessFlags;
|
use App\Models\Enums\StudyAccessFlags;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class StudyShare extends BaseModel
|
class SharedStudy extends BaseModel
|
||||||
{
|
{
|
||||||
public function study(): BelongsTo
|
public function study(): BelongsTo
|
||||||
{
|
{
|
@ -9,14 +9,15 @@
|
|||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('study_shares', function (Blueprint $table) {
|
Schema::create('shared_studies', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('study_id')->index()->constrained('studies')->cascadeOnDelete();
|
$table->foreignId('study_id')->index()->constrained('studies')->cascadeOnDelete();
|
||||||
$table->foreignId('recipient_id')->index()->constrained('users')->cascadeOnDelete();
|
$table->foreignId('recipient_id')->nullable()->index()->constrained('users')->cascadeOnDelete();
|
||||||
$table->foreignId('sender_id')->nullable()->constrained('users')->nullOnDelete();
|
$table->foreignId('sender_id')->nullable()->constrained('users')->nullOnDelete();
|
||||||
$table->unsignedTinyInteger('access_flags')->default(StudyAccessFlags::Forbidden->value);
|
$table->unsignedTinyInteger('access_flags')->default(StudyAccessFlags::Forbidden->value);
|
||||||
$table->string('access_password')->nullable();
|
$table->string('access_password')->nullable();
|
||||||
$table->dateTime('expires_at')->nullable();
|
$table->dateTime('expires_at')->nullable();
|
||||||
|
$table->string('remarks')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->unique(['study_id', 'recipient_id']);
|
$table->unique(['study_id', 'recipient_id']);
|
||||||
@ -25,6 +26,6 @@ public function up(): void
|
|||||||
|
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('study_shares');
|
Schema::dropIfExists('shared_studies');
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user