Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
v 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
milenmk committed Aug 13, 2023
1 parent 56d588e commit 3b902ad
Show file tree
Hide file tree
Showing 23 changed files with 395 additions and 134 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v 2.0.0

* Completely working version with admin panel

## v 1.0.0

* Initial version [Released 01.02.2023]
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Simple password manager written on Laravel

STILL IN DEVELOPMENT!!!

For working version of this application, go to https://github.com/milenmk/simple-password-manager

## Requirements

* PHP > 8
Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use App\Models\Domain;
use App\Models\Options;
use App\Models\Record;
use App\Models\User;
use Illuminate\Contracts\Foundation\Application;
Expand Down Expand Up @@ -40,7 +41,11 @@ public static function index(): View|Factory|Application
public static function users(): View|Factory|Application
{

return view('admin.users');
$users = User::sortable()->paginate(config('PAGINATION_NUM'));

//$users = User::sortable()->paginate(10);

return view('admin.users', compact('users'));
}

/**
Expand All @@ -51,7 +56,9 @@ public static function users(): View|Factory|Application
public static function options(): View|Factory|Application
{

return view('admin.options');
$options = Options::sortable()->paginate(config('PAGINATION_NUM'));

return view('admin.options', compact('options'));
}

}
28 changes: 14 additions & 14 deletions app/Http/Controllers/LanguageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
class LanguageController extends Controller
{

/**
* @param string $lang
*
* @return RedirectResponse
*/
public function switchLang(string $lang): RedirectResponse
{

if (array_key_exists($lang, Config::get('languages'))) {
Session::put('applocale', $lang);
}

return Redirect::back();
}
/**
* @param string $lang
*
* @return RedirectResponse
*/
public function switchLang(string $lang): RedirectResponse
{

if (array_key_exists($lang, Config::get('languages'))) {
Session::put('applocale', $lang);
}

return Redirect::back();
}

}
73 changes: 73 additions & 0 deletions app/Http/Controllers/OptionsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

namespace App\Http\Controllers;

use App\Models\Options;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class OptionsController extends Controller
{

/**
* Store a new option instance in the database
*
* @param Request $request
*
* @return RedirectResponse
*/
public function store(Request $request): RedirectResponse
{

Options::create(
[
'name' => $request->name,
'value' => $request->value,
'description' => $request->description,
]
);

return redirect('admin.options');
}

/**
* Show edit form
*
* @param Options $option
*
* @return Application|Factory|View
*/
public function edit(Options $option): View|Factory|Application
{

return view('admin.option_edit', compact('option'));
}

/**
* Update a Domain instance in the database
*
* @param Request $request
* @param Options $option
*
* @return RedirectResponse
*/
public function update(Request $request, Options $option): RedirectResponse
{

$formFields = $request->validate(
[
'name' => 'max:255',
'value' => 'required',
'description' => 'max:255',
]
);

$option->update($formFields);

return redirect('/pm-admin/options');
}

}
9 changes: 8 additions & 1 deletion app/Http/Middleware/Localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use function array_key_exists;
Expand All @@ -30,9 +32,14 @@ class Localization
public function handle(Request $request, Closure $next): mixed
{

if (isset(auth()->user()->language) && auth()->user()->language && array_key_exists(auth()->user()->language, Config::get('languages'))) {
Session::put('applocale', auth()->user()->language);
}

if (session()->has('applocale') && array_key_exists(session()->get('applocale'), config('languages'))) {
App::setLocale(session()->get('applocale'));
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified
} else { // This is optional as Laravel will automatically set the fallback language if there is
// none specified
App::setLocale(config('app.fallback_locale'));
}

Expand Down
31 changes: 31 additions & 0 deletions app/Models/Options.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types = 1);

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Kyslik\ColumnSortable\Sortable;

class Options extends Model
{

use HasFactory;
use Sortable;

public $sortable = [
'name',
'value',
'description',
'created_at',
'updated_at',
];

protected $fillable = [
'name',
'value',
'description',
];

}
11 changes: 11 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Kyslik\ColumnSortable\Sortable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
Expand All @@ -17,6 +18,16 @@ class User extends Authenticatable
use HasApiTokens;
use HasFactory;
use Notifiable;
use Sortable;

public $sortable = [
'name',
'email',
'language',
'theme',
'created_at',
'updated_at',
];

/**
* The attributes that are mass assignable.
Expand Down
24 changes: 17 additions & 7 deletions lang/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"AddDomain": "Добавете домейн",
"AddRecord": "Добавяне на запис",
"AdminDashboard": "Администраторско табло",
"Administration": "Администрация",
"AllRightsReserved": "Всички права запазени",
"Already registered?": "Имате регистрация?",
"A new verification link has been sent to the email address you provided during registration.": "На имейл адреса, който сте предоставили по време на регистрацията, е изпратен нов линк за потвърждение.",
"A new verification link has been sent to your email address.": "На вашия имейл адрес е изпратена нова връзка за потвърждение.",
"Are you sure you want to delete your account?": "Сигурни ли сте, че искате да изтриете акаунта си?",
"auth.failed": "Грешно потребителско име ИЛИ парола",
"bg_BG": "Български",
"Cancel": "Откажи",
"Change Language": "Промяна на езика",
Expand All @@ -20,11 +22,14 @@
"Continue": "Продължи",
"Copy": "Копирай",
"Create": "Създай",
"Created": "Създаден",
"Current Password": "Текуща парола",
"CurrentPassword": "Текуща парола",
"Dashboard": "Табло",
"Database": "База данни",
"Delete": "Изтрий",
"Delete Account": "Изтрий акаунт",
"Description": "Описание",
"Domain": "Домейн",
"Domains": "Домейни",
"Don't have an account?": "Нямате акаунт?",
Expand All @@ -41,6 +46,7 @@
"Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.": "Забравена парола? Няма проблем. Просто ни уведомете вашия имейл адрес и ние ще ви изпратим имейл с връзка за повторно задаване на парола, която ще ви позволи да изберете нова.",
"FTP": "FTP",
"Go to page :page": "Отидете на страницата :page",
"Go to site": "Към страницата",
"HasDatabase": "Записи за база данни",
"Hasdatabase": "Записи за база данни",
"HasFtp": "Записи за FTP",
Expand All @@ -51,17 +57,20 @@
"Hi": "Здравейте",
"Label": "Име",
"Language": "Език",
"Last :attribute users": "Последни :attribute потребителя",
"LastName": "Фамилия",
"Last update": "Последна промяна",
"Link": "URL адрес",
"Log in": "Вход",
"Login": "Вход",
"Logout": "Изход",
"Log Out": "Изход",
"Logout": "Изход",
"Name": "Име",
"New Password": "Нова парола",
"NewPassword": "Нова парола",
"NoAccountQuestion": "Нямате акаунт",
"No Records": "Няма записи",
"Number of records": "Брой записи",
"NumRecords": "Имате %s записа",
"of": "от",
"Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.": "След като акаунтът ви бъде изтрит, всички негови ресурси и данни ще бъдат изтрити за постоянно. Преди да изтриете акаунта си, моля, изтеглете всички данни или информация, които искате да запазите.",
Expand All @@ -73,6 +82,7 @@
"Profile Information": "Информация за профила",
"Records": "Записи",
"Register": "Регистрация",
"Registration date": "Дата на регистрация",
"Remember me": "Запомни ме",
"Resend Verification Email": "Повторно изпращане на имейл за потвърждение",
"Reset Password": "Възстановяване на паролата",
Expand All @@ -85,20 +95,20 @@
"Theme": "Тема",
"This is a secure area of the application. Please confirm your password before continuing.": "Това е защитена зона на приложението. Моля, потвърдете паролата си, преди да продължите.",
"to": "до",
"Top :attribute users by domain number": "Топ :attribute потребителя по брой домейни",
"Top :attribute users by records number": "Топ :attribute потребителя по брой записи",
"Type": "Тип",
"Update Password": "Актуализиране на паролата",
"Update your account's language and theme preferences.": "Актуализирайте предпочитанията за език и тема.",
"Update your account's profile information and email address.": "Актуализирайте информацията за профила и имейл адреса на вашия акаунт.",
"Url": "URL адрес",
"User": "Потребител",
"UserCreated": "Потребител е създаден",
"Username": "Потребителско име",
"Users": "Потребители",
"Value": "Стойност",
"View Records": "Покажи записи",
"ViewRecords": "Покажи записи",
"Website": "Уебсайт",
"Your email address is unverified.": "Вашият имейл адрес не е потвърден.",
"auth.failed": "Грешно потребителско име ИЛИ парола",
"Dashboard": "Табло",
"Users": "Потребители",
"Go to site": "Към страницата",
"Administration": "Администрация"
"Your email address is unverified.": "Вашият имейл адрес не е потвърден."
}
2 changes: 0 additions & 2 deletions lang/bg/pagination.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types = 1);

return [
'next' => 'Следващ',
'previous' => 'Предишен',
Expand Down
Loading

0 comments on commit 3b902ad

Please sign in to comment.