FEATURE: use more route model binding
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin\Widgets\Areas;
|
||||
|
||||
use App\CMS\Repositories\Widgets\WidgetArea as WidgetAreaRepository;
|
||||
use App\Events\DeleteWidgetArea;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\EditWidgetAreaRequest;
|
||||
use App\Models\Widgets\Widget;
|
||||
@@ -39,6 +40,7 @@ class EditWidgetArea extends Controller
|
||||
*/
|
||||
public function edit(WidgetArea $widgetArea)
|
||||
{
|
||||
return view("test");
|
||||
$associatedWidgetIds = WidgetInWidgetArea::getWidgetIdsFromArea($widgetArea->id);
|
||||
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
||||
->paginate(25);
|
||||
@@ -83,26 +85,14 @@ class EditWidgetArea extends Controller
|
||||
}
|
||||
|
||||
// delete area
|
||||
$area->delete();
|
||||
$widgetArea->delete();
|
||||
|
||||
// fire event with new widget area
|
||||
Event::fire(new \App\Events\DeleteWidgetArea($area));
|
||||
Event::fire(new DeleteWidgetArea($widgetArea));
|
||||
|
||||
// redirect and inform user
|
||||
return redirect()
|
||||
->route('widgetareas.overview')
|
||||
->with('success', trans('admin/widgetAreas.successfullyDeleted'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect user to overview with message about invalid widget area
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
private function invalidArea()
|
||||
{
|
||||
return redirect()
|
||||
->route('widgetareas.overview')
|
||||
->with('error', trans('admin/widgetAreas.invalidArea'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user