0
I have another similar route working perfect, I do not know what I missed.. I thank anyone who can help me.
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');
}
}
Result of "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 []
}
What you are sending in the parameter
itemnfe
?– adventistaam
I am learning Arabic now, so I understand this method is reading the url: https://localhost/erpoverweb/public/itensnfe/7/Edit
– Luiz
In this case, you are only sending an integer, so just put it in the function parameter
public function edit(ItemNfe $itensNfe)
thus:public function edit($itensNfe)
,– adventistaam
That one
7
is the code of Itemnfe?– adventistaam
this.. I will add the question, is the "id_itemnfe"
– Luiz