по какой-то причине, когда я пытаюсь выполнить мягкое удаление своих данных, они не исчезли в моем представлении (home.blade.php), но в моей базе данных был записан столбец delete_at, показывающий дату, когда я его удаляю. Не могли бы вы помочь мне проверить мой код, есть ли с ним какие-либо проблемы, спасибо
Вот мои коды:
home.blade.php
<table class="table table-bordered">
<tr>
<th><strong><big>Name: </big></strong></th>
<th><strong><big>Action </big></strong></th>
</tr>
<td>
<tr>
@foreach($data as $value)
<tr>
<th><a href="{{route('user.show',['id'=>$value->id])}}">{{$value->Name}}</a></th>
<th><form action="{{ url('/home/'.$value->id.'/delete') }}" method="get">
{{ csrf_field() }}
<button type="submit">Delete</button>
</form></th>
</tr>
@endforeach
</tr>
</tr>
</table>
Домашний контроллер:
public function getData(){
$data['data'] = DB::table('personal_infos')->get()->sortByDesc('created_at');
if(count($data)>0){
return view('home',$data);
}else{
return view('home');
}
public function delete($id){
personal_info::findOrFail($id)->delete();
return back();
}
Маршрут:
Route::get('/home/{id}/delete', 'HomeController@delete');
Route::get('user/show/{id}','HomeController@getInfo')->name("user.show");
Модель Personal_info:
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Eloquent;
class personal_info extends Eloquent
{
use SoftDeletes;
protected $fillable = array('Name');
protected $table = 'personal_infos';
protected $primaryKey = 'id';
protected $dates = ['deleted_at'];
public function user_info1s() {
return $this->hasMany('App\user_info1','user_id');
}