Ich habe 2 Tasten in meiner Klinge. Ich möchte die gleiche Datenbankspalte mit ihnen aktualisieren, wenn ich auf die Schaltfläche 1 klicke, aktualisiert sie die Spalte auf 1, wenn ich auf die zweite Schaltfläche klicke, aktualisiert sie die Spalte auf 2. Ich benutze die gleiche Route, um dies zu tun, weil ich muss Übergeben Sie die "ID" von der Ansicht an den Controller.2-Taste Zugriff auf verschiedene Methode in der gleichen Controller mit der gleichen Route mit Laravel
Tasten in der Ansicht:
{!! Form::open(['method' => 'GET', 'route' => ['show.approve_notification_application', $userdetail->id], 'style'=>'display:inline']) !!}
{!! Form::submit('Accpet', ['class' => 'btn btn-success']) !!}
{!! Form::close() !!}
{!! Form::open(['method' => 'GET', 'route' => ['show.approve_notification_application', $userdetail->id], 'style'=>'display:inline']) !!}
{!! Form::submit('Send to Super Admin', ['class' => 'btn btn-success']) !!}
{!! Form::close() !!}
Routen
Route::get('/notification_list/notification_application/{notification_id}', '[email protected]')->name('show.approve_notification_application');
Route::get('/notification_list/notification_application/{notification_id}', '[email protected]')->name('show.approve_notification_application');
-Controller
public function approveNotification($id){
$notification = Notification::find($id);
$notification->approved = '2';
$notification->save();
return redirect()->route('admin.notification_list');
}
public function sendNotificationToSuperAdmin($id){
$notification = Notification::find($id);
$notification->approved = '1';
$notification->save();
return redirect()->route('admin.notification_list');
}
Ich weiß nicht, wie dies zu tun. Wenn ich eine beliebige Taste klicken, wird nur der zweite Weg, die unabhängig von zu funktionieren scheint, bedeutet, welche Taste ich klicken, aktualisiert es immer um die Tabelle mit dem Wert 1
Hallo Mill3r. Wenn eine Frage gelöst ist, reicht ein Klick auf das Häkchen aus - wir verwenden hier nicht das [gelöste] Gerät, und ich habe es zuvor von Ihren Fragen entfernt. Vielen Dank. – halfer