minor changes

This commit is contained in:
Notoric 2025-03-02 19:04:31 +00:00
parent df147d9014
commit da2422e44a
3 changed files with 25 additions and 22 deletions

View File

@ -40,9 +40,9 @@ class Shortlink extends Model
$this->save(); $this->save();
} }
function generateNewId(int $length = 6): string { function generateNewId(int $length = 5): string {
$characters = 'qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM256789_'; $characters = 'qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM256789_';
// try n x 2 times to generate a new id, if it finds an id, return it, otherwise, try to look for an id of length + 1 // try n x 2 times to generate a new id, if it finds an id, return it, otherwise, try to look for an id of length n + 1
for ($i = 0; $i < $length * 2; $i++) { for ($i = 0; $i < $length * 2; $i++) {
$id = ''; $id = '';
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {

View File

@ -395,6 +395,7 @@ button {
table { table {
font-size: 1.5em; font-size: 1.5em;
border-collapse: collapse; border-collapse: collapse;
margin-bottom: 40px;
} }
table td, table th { table td, table th {
@ -420,10 +421,6 @@ table th:last-child, table td:last-child {
border-right: none; border-right: none;
} }
table {
margin-bottom: 40px;
}
footer { footer {
margin-top: auto; margin-top: auto;
height: 50px; height: 50px;

View File

@ -5,22 +5,28 @@
@endsection @endsection
@section('content') @section('content')
<h1>Profile</h1> <div id="title-container" class="container">
<p>Username: <em>{{ Auth::user()->name }}</em></p> <h1>Profile</h1>
<p>Email: <em>{{ Auth::user()->email }}</em></p> </div>
<p>Created at: <em>{{ Auth::user()->created_at }}</em></p> <div id="profile-container" class="container">
<table> <p>Username: <em>{{ Auth::user()->name }}</em></p>
<tr> <p>Email: <em>{{ Auth::user()->email }}</em></p>
<th>Link</th> <p>Created at: <em>{{ Auth::user()->created_at }}</em></p>
<th>Destination</th> </div>
<th>Created at</th> <div id="table-container" class="container">
</tr> <table>
@foreach ($shortlinks as $shortlink)
<tr> <tr>
<td><a href="{{ url()->to("l/" . $shortlink->shortid) }}">{{ $shortlink['shortid'] }}</a></td> <th>Link</th>
<td>{{ $shortlink['destination'] }}</td> <th>Destination</th>
<td>{{ Carbon\Carbon::parse($shortlink->created_at)->format('M jS Y') }}</td> <th>Created at</th>
</tr> </tr>
@endforeach @foreach ($shortlinks as $shortlink)
</table> <tr>
<td><a href="{{ url()->to("l/" . $shortlink->shortid) }}">{{ $shortlink['shortid'] }}</a></td>
<td>{{ $shortlink['destination'] }}</td>
<td>{{ Carbon\Carbon::parse($shortlink->created_at)->format('M jS Y') }}</td>
</tr>
@endforeach
</table>
</div>
@endsection @endsection