Laravel-dd命令所需参数显示为空



我试图从公司列表中显示一家公司,但当我点击一家公司时,它会转到右侧页面,但显示为空(公司没有属性(

我的路线:

Route::resource('Companies',AppHttpControllersCompanyController::class);

我的看法(公司(

<div class="card-body  ">
<ul>
@forelse($companies as $Company)

<li>
<a href="{{route('Companies.show',$company)}}">
<label>Name: {{$company->name}}</label><br>
<label>Name: {{$company->email}}</label><br>
<label> Phone: {{$company->phone}}</label>
</a>
</li>

@empty
<h2>Companies</h2>
@endforelse
</ul>

我的控制器:

public function show(Company $company)
{
dd($company);
}

dd:的输出

#guarded: []
#connection: null
#table: null
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: false
+wasRecentlyCreated: false
#attributes: []
#original: []
#changes: []
#casts: []
#classCastCache: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []

有人能告诉我为什么会发生这种事吗?

<a href="{{route('companies.show', ['Company' => $company->id)}}">

最新更新