refactored file migration, view and controller
This commit is contained in:
parent
b1cd352165
commit
93592992b7
|
@ -35,9 +35,8 @@ class FileController extends Controller
|
||||||
abort_if(Auth::guest(), 403);
|
abort_if(Auth::guest(), 403);
|
||||||
|
|
||||||
$receptionScreens = ReceptionScreen::pluck('name', 'id');
|
$receptionScreens = ReceptionScreen::pluck('name', 'id');
|
||||||
$idsReceptionScreens = $receptionScreens->keys()->toArray();
|
|
||||||
$files = File::where('reception_screen_id', '=', $idReceptionScreen)->get();
|
$files = File::where('reception_screen_id', '=', $idReceptionScreen)->get();
|
||||||
return view('files.create', compact('receptionScreens', 'idsReceptionScreens', 'idReceptionScreen', 'files'));
|
return view('files.create', compact('receptionScreens', 'idReceptionScreen', 'files'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(StoreFileRequest $request)
|
public function store(StoreFileRequest $request)
|
||||||
|
|
|
@ -13,6 +13,7 @@ class File extends Model
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
|
'file_name',
|
||||||
'url',
|
'url',
|
||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
|
|
|
@ -14,6 +14,7 @@ return new class extends Migration
|
||||||
Schema::create('files', function (Blueprint $table) {
|
Schema::create('files', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('file_name')->nullable();
|
||||||
$table->string('description')->nullable();
|
$table->string('description')->nullable();
|
||||||
$table->string('url');
|
$table->string('url');
|
||||||
$table->integer('position');
|
$table->integer('position');
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
{{ Form::label('idReceptionScreen', 'Пункт экрана приема') }}
|
{{ Form::label('idReceptionScreen', 'Пункт экрана приема') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
{{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, $idsReceptionScreens,['class' => 'form-select']) }}
|
{{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, ['class' => 'form-select']) }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
|
Loading…
Reference in New Issue