반응형
CONTROLLER
ProductModel::where('id',$id)->update([
'name' => $request->name,
'r_name' => $request->r_name,
'asset_group_id' => $request->asset_group_id
]);
return redirect(route('product.index'));
계속 있는 필드인데도..
없다고 나온다.
BLADE
<form
action="{{ route('productmodify.update',$output->id) }}"
method="POST"
enctype="multipart/form-data"
@csrf
@method('PATCH')
<div class="mb-3 row">
<label class="col-sm-33 col-form-label" style="font-weight: normal; color: #869ac0;">에셋파일 : </label>
<div class="col-sm-10 " style="display: flex; flex-direction: row;" >
<input type="text" name="name" class="form-control" value="{{ $output->name }}" style="color: #869ac0; border: 1px solid #99999; background-color: transparent; width:30%;"><i class="fas fa-pencil-alt fa-lg fa-fw" style="color: rgb(180, 180, 180);padding-left:10px;padding-top: 18px"></i></input>
</div>
</div>
ERROR
[해결방법]
모델수정 전
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductModel extends Model
{
use HasFactory;
protected $table = 'vcms_assets';
}
모델 수정 후
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductModel extends Model
{
use HasFactory;
public $timestamps = false;
protected $table = 'vcms_assets';
protected $fillable = ['name', 'r_name', 'asset_group_id'];
}
반응형
'이과 > laravel 자료' 카테고리의 다른 글
cURL error 60: SSL certificate problem 에러 (0) | 2023.10.18 |
---|---|
Object 를 저장후 json 으로 가져오기. (4) | 2022.11.29 |
[LARAVEL] undefined method App\Models\FREE::links() (1) | 2022.08.23 |
[LARAVEL] 데이터 migration 명령어 (0) | 2022.08.17 |
[Laravel] 페이지네이션 에러 (0) | 2022.08.17 |
댓글