https://github.com/FriendsOfCake/bootstrap-ui
- Instalacja i uruchomienie pluginu
- Skopiowanie assetów
- AppView – uruchomienie treat’u initializeUI
- Wygenerowanie szablonów typu BootstrapUI
https://github.com/FriendsOfCake/bootstrap-ui
# cd /var/www/my_project # cp -r vendor/cakephp/bake/templates/bake/ templates/bake/ - od tej pory do generowania modułu (bin/cake bake ..) będzie użyty lokalny szablon
# usermod -a -G www-data <username> // Weryfikacja # groups <username> <username>: username git www-data
$next_nb = str_pad((string) $next, 2, '0', STR_PAD_LEFT);
Lista ikon: https://icons.getbootstrap.com/
Najlepsza metoda – instalacja npm i kopiowanie do właściwych katalogów Czytaj dalej Bootstrap Icons
W szablonie:
<?php $user_id = $this->getRequest()->getAttribute('identity')->getIdentifier(); ?>
W kontrolerze:
$user_id = $this->Authentication->getIdentity()->getIdentifier();
$role = $this->Authentication->getIdentity()->get('role'); $role == 'admin' || 'user'
Wyłączenie z dostępu po zalogowaniu
use Cake\Event\EventInterface; public function beforeFilter(EventInterface $event): void { parent::beforeFilter($event); if(!$this->is_admin) { $this->Flash->error(__('Nie ma takiej strony')); $event->setResult($this->redirect('/')); return; } $this->Authentication->addUnauthenticatedActions(['edit', 'changePassword' ]); }
<!-- CSRF Token jako ukryte pole (fallback) --> <input type="hidden" name="_csrfToken" id="csrf-token-field" value="<?= $this->request->getAttribute('csrfToken') ?>">
let url = new URL(location.href); $("#proj-tabs").find(".nav-link").on('click', function() { var tab_name = $(this).attr('data-bs-target').replace("#", ""); url.searchParams.set("s_tab", tab_name); history.replaceState(null, null, url.href); });
Między serwerem developerskim -> repozytorium -> serwerem produkcyjnym
Instaluje główne repozytorium git na debianie:
# apt install git // dedykowany użytkownik git # adduser --system --shell /bin/bash --group --home /home/git git
Problem polega na tym, że CakePHP owija pole w <div class="input"> który nie ma width: 100% w kontekście Bootstrap input-group. Rozwiązanie — użyj opcji 'templates' żeby usunąć ten wrapper:
Czytaj dalej CakePHP Input Group z Bootstrap’em – pole input za wąskie
Usuwa żółte tła:
CREATE TABLE trs_new LIKE trs;
https://github.com/johnzuk/GusApi
https://api.stat.gov.pl/Home/RegonApi
validateNip($nip) - Sprawdza poprawność - Invoice::validateNip('1234567890') → true normalizeNip($nip) - Usuwa myślniki, spacje - Invoice::normalizeNip('123-456-78-90') → '1234567890' formatNip($nip) - Formatuje XXX-XXX-XX-XX - Invoice::formatNip('1234567890') → '123-456-78-90' generateRandomNip() - Generuje losowy - NIP - Invoice::generateRandomNip() → '857-234-19-23' getTestNip() - Stały NIP testowy - Invoice::getTestNip() → '123-456-78-16' isForeignNip($nip) - Czy NIP zagraniczny - Invoice::isForeignNip('9912345678') → true getNipInfo($nip) - Debug info Zwraca tablicę z detailami seller_nip_formatted - Virtual field - $invoice->seller_nip_formatted → '123-456-78-90' buyer_nip_formatted - Virtual field - $invoice->buyer_nip_formatted → '123-456-78-90'
cd /var/www/biznes
Assety zainstalowane za pomocą npm i skopiowane do webroot/
# cd /var/www/biznes # mkdir webroot/css/vendor # mkdir webroot/js/vendor
Poprawne NIPy
5261040828 ✓ (poprawna suma kontrolna)
1234563218 ✓ (poprawna suma kontrolna)
7010416109 ✓ (poprawna suma kontrolna)
5261040567 ✓ (poprawna suma kontrolna)
Ministerstwo Finansów: 5260250274
'App' => [
'defaultTimezone' => 'UTC',
// ...
],
// wyświetlanie
$date->i18nFormat('yyyy-MM-dd HH:mm', 'Europe/Warsaw');
Dodawanie nowej domeny – katalog, konfiguracja Apache2, certbot
# certbot --apache - dodaje certyfikat wskazany z listy # certbot renew # certbot delete -d domena.pl # certbot certificates - lista certyfikatów # certbot certonly --webroot -w /var/www/html/MYAPP/webroot -d MYDOMAIN.pl
SELECT invoice_number, invoice_hash, seller_address, payment_method, sale_date, COUNT(*) OVER() as total FROM purchase_invoices;
-- ABC/123/2026 | bUkGCk34... | ul. Testowa 4 | Przelew | 2026-01-24 | 1
WIN+R – okno wyszukiwania
– wpisz komendę:
netplwiz - konta użytkowników - zalogowani - usunięcie
# adduser nowy_user // User nowy_user dodany do grupy sudo - uprawnienia roota # usermod -aG sudo nowy_user
Różne operacje na certyfikatach:
1. Wgrywamy wszystkie wymagane certyfikaty do /tmp/gus-cert 2. Przygotowujemy tylko certyfikaty w formacie PEM 3. Mogą mieć rozszerzenia .pem lub .crt 4. Zamieniamy rozszerzenia na .crt
# dos2unix gus-verify-certs.sh // LUB jeśli nie masz dos2unix: # sed -i 's/\r$//' gus-verify-certs.sh
https://claude.ai/chat/4cc1d3ee-fca7-47c3-ae8e-069e207e025c
W: Failed to fetch https://packages.sury.org/php/dists/bullseye/InRelease 503 certificate has expired [IP: 146.75.63.52 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.