|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
+use App\Enums\UsefulLinkLocation;
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Models\UsefulLink;
|
|
|
use Illuminate\Contracts\Foundation\Application;
|
|
@@ -30,7 +31,8 @@ class UsefulLinkController extends Controller
|
|
|
*/
|
|
|
public function create()
|
|
|
{
|
|
|
- return view('admin.usefullinks.create');
|
|
|
+ $positions = UsefulLinkLocation::cases();
|
|
|
+ return view('admin.usefullinks.create')->with('positions', $positions);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -48,7 +50,14 @@ class UsefulLinkController extends Controller
|
|
|
'description' => 'required|string|max:2000',
|
|
|
]);
|
|
|
|
|
|
- UsefulLink::create($request->all());
|
|
|
+
|
|
|
+ UsefulLink::create([
|
|
|
+ 'icon' => $request->icon,
|
|
|
+ 'title' => $request->title,
|
|
|
+ 'link' => $request->link,
|
|
|
+ 'description' => $request->description,
|
|
|
+ 'position' => implode(",",$request->position),
|
|
|
+ ]);
|
|
|
|
|
|
return redirect()->route('admin.usefullinks.index')->with('success', __('link has been created!'));
|
|
|
}
|
|
@@ -72,8 +81,10 @@ class UsefulLinkController extends Controller
|
|
|
*/
|
|
|
public function edit(UsefulLink $usefullink)
|
|
|
{
|
|
|
+ $positions = UsefulLinkLocation::cases();
|
|
|
return view('admin.usefullinks.edit', [
|
|
|
'link' => $usefullink,
|
|
|
+ 'positions' => $positions,
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -93,7 +104,13 @@ class UsefulLinkController extends Controller
|
|
|
'description' => 'required|string|max:2000',
|
|
|
]);
|
|
|
|
|
|
- $usefullink->update($request->all());
|
|
|
+ $usefullink->update([
|
|
|
+ 'icon' => $request->icon,
|
|
|
+ 'title' => $request->title,
|
|
|
+ 'link' => $request->link,
|
|
|
+ 'description' => $request->description,
|
|
|
+ 'position' => implode(",",$request->position),
|
|
|
+ ]);
|
|
|
|
|
|
return redirect()->route('admin.usefullinks.index')->with('success', __('link has been updated!'));
|
|
|
}
|