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);
|
||||
|
||||
$receptionScreens = ReceptionScreen::pluck('name', 'id');
|
||||
$idsReceptionScreens = $receptionScreens->keys()->toArray();
|
||||
$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)
|
||||
|
|
|
@ -13,6 +13,7 @@ class File extends Model
|
|||
protected $fillable = [
|
||||
'id',
|
||||
'name',
|
||||
'file_name',
|
||||
'url',
|
||||
'description',
|
||||
];
|
||||
|
|
|
@ -14,6 +14,7 @@ return new class extends Migration
|
|||
Schema::create('files', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('file_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->string('url');
|
||||
$table->integer('position');
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{{ Form::label('idReceptionScreen', 'Пункт экрана приема') }}
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, $idsReceptionScreens,['class' => 'form-select']) }}
|
||||
{{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
|
|
Loading…
Reference in New Issue