1

データベースに (id、title、post) 列を持つテーブル (post) があります。
テーブルに同じタイトルのレコードが 3 つありますが、最初のレコードだけが返されます。
Route Model Binding を使用して同じタイトルのすべてのレコードを返す方法は?

これは私のルートです:

Route::get('bind/{key:title}',[RouteModelBindingController::class, 'index']);

これは私のコントローラクラスです:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Post;
class RouteModelBindingController extends Controller
{
    public function index(Post $key){
      return $key;
    }
}
4

0 に答える 0