Skip to content
Snippets Groups Projects
Commit c3ae7e08 authored by LIENHARDT QUENTIN's avatar LIENHARDT QUENTIN :snake:
Browse files

Hide create subject form if not logged in

parent 91bf4eae
Branches
No related merge requests found
......@@ -5,20 +5,25 @@
</h2>
</x-slot>
<form action="{{ route('subject.store') }}" method="POST">
@csrf
<input type="text" name="name" placeholder="Name" value="{{ old('name') }}">
<br>
<textarea name="description" cols="30" rows="10" placeholder="Description">{{ old('description') }}</textarea>
<br>
<button type="submit" class="p-1 bg-green-500 text-white">Create subject!</button>
</form>
{{-- Do not display the for if not logged in (even if store is disabled: double protection) --}}
@if (Auth::user())
<form action="{{ route('subject.store') }}" method="POST">
@csrf
<input type="text" name="name" placeholder="Name" value="{{ old('name') }}">
<br>
<textarea name="description" cols="30" rows="10" placeholder="Description">{{ old('description') }}</textarea>
<br>
<button type="submit" class="p-1 bg-green-500 text-white">Create subject!</button>
</form>
@if ($errors->any())
<br>
<h3>Errors</h3>
@foreach ($errors->all() as $item)
<li>{{ $item }}</li>
@endforeach
@if ($errors->any())
<br>
<h3>Errors</h3>
@foreach ($errors->all() as $item)
<li>{{ $item }}</li>
@endforeach
@endif
@else
<p>You are not logged in...</p>
@endif
</x-app-layout>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment