Level 75
I don't see any related code which cause your issue.
1 like
I am stuck with those for a long time. Please help me. I don't want to pass with this id in a URL like this. How can I do that?
http://127.0.0.1:8001/packages/27/edit?id=27
web.php
Route::post('packages/{package}', [PackageController::class, 'update'])->name('update.packages');
Route::get('packages/{package}/edit', [PackageController::class, 'edit'])->name('edit.packages');
controller.php
public function edit(Package $package)
{
return view('templates.webapp.' . getTemplate() . '.pages.packages.edit', [
'creditTypes' => creditType::get(),
'package' => $package,
]);
}
public function update(Package $package, StorePackageRequest $request)
{
if (!Gate::allows('update-package', $package)) {
abort(403);
}
$data = $request->validated();
$data['site_id'] = auth()->user()->site_id;
$package->update($data);
return back()->withSuccess('Update Packages Successful');
}
index.blade.php edit button and delete button
<td>
<i data-id="{{ $package->id }}"
data-route="{{ route('edit.packages', $package->id) }}"
class="fa fa-pencil edit-me" aria-hidden="true"></i>
<i data-id="{{ $package->id }}"
data-route="{{ route('destroy.packages', $package->id) }}"
class="fa fa-trash delete-me" aria-hidden="true"></i>
</td>
Where does this URL http://127.0.0.1:8001/packages/27/edit?id=27 come from? Come from press edit btn and going edit page. Now I have been fixed. Cause of this data-id="{{ $package->id }}".
Please or to participate in this conversation.