Php Laravel循环过滤器uuid字符
我试图在视图中显示项目的uuid,但其输出与实际数据不同Php Laravel循环过滤器uuid字符,php,laravel,eloquent,Php,Laravel,Eloquent,我试图在视图中显示项目的uuid,但其输出与实际数据不同 @forelse($sections as $section) <tr> <th scope="row">{{ $loop->iteration }}</th> <td>{{ $section->title_hy }}</td> <td>{{ $section->title_en }}</td&g
@forelse($sections as $section)
<tr>
<th scope="row">{{ $loop->iteration }}</th>
<td>{{ $section->title_hy }}</td>
<td>{{ $section->title_en }}</td>
<td><div class="d-flex justify-content-center">
<a href="" class="btn btn-sm btn-primary mr-2">
<i class="fas fa-edit mr-2"></i>@lang('sections.edit')</a>
<form class="contain-button-sm" action="{{ route('sections.destroy', $section->id) }}" method="post">
@method('delete')
@csrf
<button type="submit" class="btn btn-sm btn-danger">
<i class="fas fa-trash mr-2"></i>@lang('sections.delete')</button>
</form>
</div>
</td>
</tr>
@endforeach
事实上应该是这样的
"22f3ffe3-855a-4f27-90c9-0f40894887be"
我甚至把这些部分都扔了,这就是里面的东西
Collection {#291 ▼
#items: array:1 [▶
0 => Section {#292 ▶
#connection: "mysql"
#table: "sections"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:5 [▶
"id" => "22f3ffe3-855a-4f27-90c9-0f40894887be"
"title_hy" => "Արվեստ"
"title_en" => "Art"
"created_at" => "2019-08-07 21:03:35"
"updated_at" => "2019-08-07 21:03:35"
]
#original: array:5 [▶
"id" => "22f3ffe3-855a-4f27-90c9-0f40894887be"
"title_hy" => "Արվեստ"
"title_en" => "Art"
"created_at" => "2019-08-07 21:03:35"
"updated_at" => "2019-08-07 21:03:35"
]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
#guarded: array:1 [▶
0 => "*"
]
}
]
}
当我从循环中转储单个部分时,它会过滤字符,并且出于某种原因只保留前两个数字。有没有办法让我获得完整的id?试试这个:
$section['id']
还是这个
$section['_id']
并尝试在路由URL中传递{id}。例如:
Route::delete('{id}', 'ProjectController@destroy')->middleware('verified');
试试这个:
$section['id']
还是这个
$section['_id']
并尝试在路由URL中传递{id}。例如:
Route::delete('{id}', 'ProjectController@destroy')->middleware('verified');
尝试将id列强制转换为模型中的string:
protected $casts = [
'id' => 'string'
]
默认情况下,id是整数尝试在模型中将id列强制转换为字符串:
protected $casts = [
'id' => 'string'
]
默认情况下,id是整数不幸的是,同样的事情:(不幸的是,同样的事情:(