Skip to content

Commit 7fb6068

Browse files
committed
Made link title optional
Made link title (previously required) optional when adding personal LittleLink links on the User/Admin Panel. If the 'Title' field is left empty, the button name is now used instead of rejecting the addition.
1 parent fe7fc9f commit 7fb6068

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

app/Http/Controllers/UserController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ public function addLink(request $request)
6060
{
6161
$request->validate([
6262
'link' => 'required',
63-
'title' => 'required',
63+
'title' => '',
6464
'button' => 'required'
6565
]);
6666

6767
$link = $request->link;
68+
if ($request->title == '')
69+
$title = $request->button;
70+
else
6871
$title = $request->title;
6972
$button = $request->button;
7073

resources/views/studio/add-link.blade.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
<form action="{{ route('addLink') }}" method="post">
88
@csrf
99
<div class="form-group col-lg-8">
10-
<label>Link</label>
10+
<label>Link*</label>
1111
<input type="text" name="link" class="form-control" placeholder="https://google.com">
1212
</div>
1313
<div class="form-group col-lg-8">
1414
<label>Title</label>
15-
<input type="text" name="title" class="form-control" placeholder="Google">
15+
<input type="text" name="title" class="form-control" placeholder="Internal name (optional)">
1616
</div>
1717
<div class="form-group col-lg-8">
18-
<label for="exampleFormControlSelect1">Button</label>
18+
<label for="exampleFormControlSelect1">Button*</label>
1919
<select class="form-control" name="button">
2020
@foreach($buttons as $button)
21+
@if($button->name == 'custom')
22+
<option>Custom button (Title determines text on button)</option>
23+
@else
2124
<option> {{ $button->name }} </option>
25+
@endif
2226
@endforeach
2327
</select>
28+
<br>
29+
<label>* Required fields</label><br>
2430
</div>
2531
<button type="submit" class="mt-3 ml-3 btn btn-info">Submit</button>
2632
</form>

0 commit comments

Comments
 (0)