我想获取带有 id 的项目的数据,但是 [Route: shop.show] [URI: lord-ganesha-7514796/{id}] [Missing parameter: id] 出错

I want to fetch data of item with id but geeting error for [Route: shop.show] [URI: lord-ganesha-7514796/{id}] [Missing parameter: id]

“我想获取带有 id 的项目的数据,但收到错误提示 [Route: shop.show] [URI: lord-ganesha-7514796/{id}] [缺少参数: id] “

My Controller code is
class ECommerceController extends Controller
{
    
  public function index(Request $request)
  {
    $datas = DB::select('select * from ShoppingItems');
    return view('welcome',['datas'=>$datas]);
   

  }

  public function show(Request $request,$id)
  {
    $datas = DB::find($id);
    
    return view('shop.show',['datas'=>$datas]);
  }


 Web Route is

 Route::get('/','App\Http\Controllers\ECommerceController@index')->name('welcome');

 Route::get('/lord-ganesha-7514796/{id}','App\Http\Controllers\ECommerceController@show')->name('shop.show');

welcome.blade.php(dashboard)

<div class="container">
     @foreach ($datas as $data)
     <a href="{{ route('shop.show',['datas'=> $datas])  }}"></a>
      
    <div  class="box1">
        <img src="https://thumbs.dreamstime.com/b/lord-ganesha-7514796.jpg">
        <div class="overlay">
        {{ $data->god_name }}
       </div>
       
    </a> 
         @endforeach

已编辑 您需要将数组键从 datas 更改为在您的路由中定义的 id:

<a href="{{ route('shop.show',['id'=> $datas])  }}"></a>

同时将 DB::find() 更改为:

DB::table('table_name')->find($id);