added things to external link views and worked in controller
This commit is contained in:
parent
59deaf5eb3
commit
89082b281b
|
@ -19,7 +19,7 @@ class ExternalLinkController extends Controller
|
|||
{
|
||||
$externalLink = ExternalLink::query()->paginate($request->input("limit", 20));
|
||||
|
||||
return Response::detect("external-links.index", [ "externalLinks" => $externalLink ]);
|
||||
return Response::detect("external-links.index", [ "links" => $externalLink ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ class ExternalLinkController extends Controller
|
|||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return Response::detect("external-links.show", [ "externallink" => $id]);
|
||||
return Response::detect("external-links.show", [ "link" => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class ExternalLinkController extends Controller
|
|||
public function edit($id)
|
||||
{
|
||||
$link = ExternalLink::find($id);
|
||||
return Response::detect("external-links.edit", ["externallink" => $link]);
|
||||
return Response::detect("external-links.edit", ["link" => $link]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,8 @@ class ExternalLinkController extends Controller
|
|||
public function update(Request $request, $id)
|
||||
{
|
||||
$data = $request->validate([
|
||||
"name" => "",
|
||||
"link" => ""
|
||||
"name" => "max:255",
|
||||
"link" => "max:255"
|
||||
]);
|
||||
|
||||
$id->update($data);
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\ExternalLink;
|
|||
use App\MenuPlan;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class MenuPlanController extends Controller
|
||||
|
@ -40,6 +41,7 @@ class MenuPlanController extends Controller
|
|||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
Log::debug("SAVED Menuplan");
|
||||
$requestMenuPlanCreate = $request->validate([
|
||||
"name" => "required|max:255",
|
||||
"link" => "required|max:255"
|
||||
|
@ -48,6 +50,7 @@ class MenuPlanController extends Controller
|
|||
$menuPlans = new MenuPlan($requestMenuPlanCreate);
|
||||
$menuPlans->save();
|
||||
|
||||
|
||||
return Response::detect("menuplans.store");
|
||||
}
|
||||
|
||||
|
@ -59,7 +62,7 @@ class MenuPlanController extends Controller
|
|||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return Response::detect("menu-plan.show", [ "menu-plans" => $id]);
|
||||
return Response::detect("menuplans.show", [ "menuplans" => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,8 +73,7 @@ class MenuPlanController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$editLink = MenuPlan::find($id);
|
||||
return Response::detect("menu-plans.edit", ["menu-plans" => $editLink]);
|
||||
return Response::detect("menuplans.edit", ["menuplans" => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<form method="post" action="{{ route("external-links.store") }}">
|
||||
@csrf
|
||||
<label for="title">Titel:</label>
|
||||
<input type="text" name="title" id="title" required>
|
||||
<input type="text" name="name" id="title" required>
|
||||
<label for="link">Linket:</label>
|
||||
<input type="text" name="link" id="link" required>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('external-links.edit') }}" class="text-white">Rediger Link</a> /
|
||||
<a href="../external-links/edit.blade.php" class="text-white">Rediger Link</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<h1>Rediger Link:</h1>
|
||||
<form method="post" action="">
|
||||
<form method="post" action="{{ route("external-links.update", ['name' => $link->name]) }}">
|
||||
@csrf
|
||||
<label for="title">Titel:</label>
|
||||
<input type="text" name="title" id="title" required>
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
</tr>
|
||||
@foreach($links as $link)
|
||||
<tr>
|
||||
<th>{ID}</th>
|
||||
<th>{Titel}</th>
|
||||
<th>{Link}</th>
|
||||
<th>{{ $link->id }}</th>
|
||||
<th>{{$link->name}}</th>
|
||||
<th><a href="{{$link->link}}"> {{$link->link}} </th>
|
||||
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
@extends("admin.layout.base")
|
||||
@extends("admin.layout.header")
|
||||
|
||||
@section("title")
|
||||
Link - Opret
|
||||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('external-links.create') }}" class="text-white">Opret External Link</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
Link blev (ikke) oprettet.
|
||||
@endsection
|
|
@ -0,0 +1,14 @@
|
|||
@extends("admin.layout.base")
|
||||
@extends("admin.layout.header")
|
||||
|
||||
@section("title")
|
||||
link - Rediger
|
||||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('external-links.index') }}" class="text-white">External link</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
Din link blev (ikke) redigeret.
|
||||
@endsection
|
|
@ -6,12 +6,13 @@
|
|||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('menu-plans.edit') }}" class="text-white">Rediger Menuplan</a> /
|
||||
<a class="text-white">Rediger Menuplan</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<h1>Rediger Menuplan:</h1>
|
||||
<form method="post" action="">
|
||||
<form method="post" action="{{ route("menu-plans.store") }}">
|
||||
@csrf
|
||||
<label for="mandag">Mandag:</label>
|
||||
<input type="text" name="mandag" id="mandag" value="{Mandag}" required>
|
||||
<label for="tirsdag">Tirsdag:</label>
|
||||
|
|
Loading…
Reference in New Issue