Tenho outra rota semelhante funcionando perfeito, não sei o que deixei passar.. agradeço a quem puder ajudar.
Route:
Route::get('/itensnfe/{itemnfe}/edit', 'ItensNfeController@edit')->name('itensnfe.edit');
Controller:
namespace App\Http\Controllers;
use App\ItemNfe;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ItensNfeController extends Controller{
public function edit(ItemNfe $itensNfe)
{
dd($itensNfe);
}
}
Model:
namespace App;
use Illuminate\Database\Eloquent\Model;
class ItemNfe extends Model
{
protected $table = 'itens_nfe;'
protected $primaryKey = 'id_itemnfe';
protected $fillable = ['id_itemnfe','fk_nfe','cprod','cean','xprod','ncm','cfop','ucom','qcom','vuncom'
'vprod','ceantrib','utrib','qtrib','vuntrib','vfrete','indtot',
'nitemped',
'vtottrib','orig','csosn',
'cenq','cst','vbc','pipi','vipi',
'cst_pis','vbc_pis','ppis','vpis',
'cst_cofins','vbc_cofins','pcofins','vcofins'
];
public function nfe()
{
return $this->hasOne('App\Nfe');
}
}
Resultado do "dd($itensNfe);":
App\ItemNfe {#1272 ▼
#table: "itens_nfe"
#primaryKey: "id_itemnfe"
#fillable: array:34 [▶]
#connection: null
#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: []
#guarded: array:1 [▶]
}
itemnfe
?7
é o codigo do ItemNFE?