Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
0afa8a7aa3
|
@ -83,15 +83,13 @@ class ExternalLinkController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$data = $request->validate([
|
$data = $request->all();
|
||||||
"name" => "max:255",
|
|
||||||
"link" => "max:255"
|
|
||||||
]);
|
|
||||||
|
|
||||||
$id->update($data);
|
$link = ExternalLink::find($id);
|
||||||
$id->save();
|
$link->update($data);
|
||||||
|
$link->save();
|
||||||
|
|
||||||
return Response::detect("external-links.update");
|
return Response::detect("external-links.update", [ "link" => $link]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +100,8 @@ class ExternalLinkController extends Controller
|
||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$id->delete();
|
$link = ExternalLink::find($id);
|
||||||
return Response::detect("external-links.destroy");
|
$link->delete();
|
||||||
|
return redirect()->route("external-links.index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,18 @@
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section("path")
|
@section("path")
|
||||||
<a href="../external-links/edit.blade.php" class="text-white">Rediger Link</a> /
|
<a href="{{route('external-links.edit', ['external_link' => $link])}}" class="text-white">Rediger Link</a> /
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section("content")
|
@section("content")
|
||||||
<h1>Rediger Link:</h1>
|
<h1>Rediger Link:</h1>
|
||||||
<form method="post" action="{{ route("external-links.edit", ['external_link' => $link]) }}">
|
<form method="post" action="{{route("external-links.update", ["external_link" => $link])}}">
|
||||||
@csrf
|
@csrf
|
||||||
|
@method("PUT")
|
||||||
<label for="title">Titel:</label>
|
<label for="title">Titel:</label>
|
||||||
<input type="text" name="title" id="title" required>
|
<input value="{{$link->name}}" type="text" name="title" id="title" required>
|
||||||
<label for="link">Linket:</label>
|
<label for="link">Linket:</label>
|
||||||
<input type="text" name="link" id="link" required>
|
<input value="{{$link->link}}" type="text" name="link" id="link" required>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||||
</form>
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -21,8 +21,13 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{$link->name}}</th>
|
<th>{{$link->name}}</th>
|
||||||
<th><a href="{{$link->link}}">{{$link->link}}</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="{{ route("external-links.edit", [ "external_link" => $link ]) }}"><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>
|
<td> <form method="post" action="{{ route("external-links.destroy", [ "external_link" => $link ]) }}" class="w-100">
|
||||||
|
@csrf
|
||||||
|
@method("delete")
|
||||||
|
|
||||||
|
<button class="w-100" type="submit"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
|
||||||
|
</form></td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section("path")
|
@section("path")
|
||||||
<a href="{{ route('external-links.index') }}" class="text-white">External link</a> /
|
<a href="{{ route('external-links.edit', ["external_link" => $link]) }}" class="text-white">External link</a> /
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section("content")
|
@section("content")
|
||||||
|
|
Loading…
Reference in New Issue