Route::resource('recipe', 'RecipeController');当您使用等定义资源时,会定义以下路由: /photo/{photo}/edit,一旦您定义了所有资源,您就会得到如下所示的内容:
/recipes/{recipes}/edit/allergens/{allergens}/edit/ingredients/{ingredients}/edit因为我的所有记录都用id作主键(MongoDB),所以我想改为{id}这样:
/recipes/{id}/edit/allergens/{id}/edit/ingredients/{id}/edit我在Router课堂上进行了挖掘,但我不知道如何指定这一点。
更重要的是,当我创建一个表单时,Form::model($record)我会得到诸如/recipes/{recipes}“因为recipes是 的属性”之类的操作$record。
如何将关键参数的名称定义id为recipes, allergens, ingredients?