v1.1.0c -Fixed some small things

This commit is contained in:
Neerholt 2020-09-11 09:08:07 +02:00
parent de3ed9c326
commit 78ab6be31a
2 changed files with 12 additions and 14 deletions

View File

@ -99,8 +99,7 @@ class GuidesCategoryController extends Controller
public function update(Request $request, GuidesCategory $guidesCategory) public function update(Request $request, GuidesCategory $guidesCategory)
{ {
$data = $request->validate([ $data = $request->validate([
"name" => "required|max:255", "guidesCategoryName" => "required|max:255",
"guide_articles" => "required",
]); ]);
$guideCate = Guide::query()->where("id", "=", $guidesCategory->id)->first(); $guideCate = Guide::query()->where("id", "=", $guidesCategory->id)->first();

View File

@ -2,21 +2,21 @@
@extends("admin.layout.header") @extends("admin.layout.header")
@section("title") @section("title")
Lokation - Rediger Kategori - Rediger
@endsection @endsection
@section("path") @section("path")
<a href="{{route('locations.edit', ['location' => $location ])}}" class="text-white">Rediger lokation</a> / <a href="{{route('guides-category.edit', ['guidesCategory' => $guidesCate ])}}" class="text-white">Rediger kategori</a> /
@endsection @endsection
@section("content") @section("content")
<h1>Rediger Lokation</h1> <h1>Rediger vejlednings kategori</h1>
<form method="post" action="{{ route("locations.update", ['location' => $location ]) }}"> <form method="post" action="{{ route("guides-category.update", ['guidesCategory' => $guidesCate ]) }}">
@csrf @csrf
@method("put") @method("put")
<label for="name">Lokationsnavn:</label> <label for="name">Kategori navn:</label>
<label hidden id="error" for="errormesseages">Lokation findes allerede</label> <label hidden id="error" for="errormesseages">kategorien findes allerede</label>
<input type="text" name="name" id="name" value="{{ $location->name }}" required> <input type="text" name="name" id="name" value="{{ $guidesCate->name }}" required>
<input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger"> <input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger">
</form> </form>
@endsection @endsection
@ -36,10 +36,9 @@
$value = $('#name').val(); $value = $('#name').val();
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: '{{route('locations.nameCheckUpdate')}}', url: '{{route('guides-category.nameCheckUpdate')}}',
data: {'nameCheck':$value, 'id':{{$location->id}}}, data: {'nameCheck':$value, 'id':{{$guidesCate->id}}},
success:function (data) { success:function (data) {
console.log(data);
if(data){ if(data){
$("#error").show(100); $("#error").show(100);
$("#error").css('color', 'red'); $("#error").css('color', 'red');
@ -62,8 +61,8 @@
$value = $(this).val(); $value = $(this).val();
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: '{{route('locations.nameCheckUpdate')}}', url: '{{route('guides-category.nameCheckUpdate')}}',
data: {'nameCheck':$value, 'id':{{$location->id}}}, data: {'nameCheck':$value, 'id':{{$guidesCate->id}}},
success:function (data) { success:function (data) {
if(data){ if(data){
$("#error").show(100); $("#error").show(100);