Szybki start
Minimalny działający moduł „Notatki zespołu”: lista notatek i formularz dodawania. Pięć plików.
narzedzia/notatki/
narzedzie.php
trasy.php
src/NotatkiController.php
widoki/index.blade.php
migracje/2026_09_25_120000_create_notatki_table.phpnarzedzia/notatki/narzedzie.php:
PHP
<?php
return [
'nazwa' => 'Notatki zespołu',
'wersja' => '1.0.0',
'zmiany' => [
'1.0.0' => ['Pierwsza wersja: lista notatek i dodawanie nowej.'],
],
'wymaga_portalu' => '1.3.20',
'opis' => 'Krótkie notatki widoczne dla całego zespołu.',
'ikona' => '🗒️',
'kategoria' => 'dokumenty',
'domyslnie' => false,
'trasy' => ['prefiks' => 'narzedzia/notatki', 'nazwy' => 'notatki.'],
];narzedzia/notatki/trasy.php:
PHP
<?php
use Illuminate\Support\Facades\Route;
use Narzedzia\Notatki\NotatkiController;
Route::get('/', [NotatkiController::class, 'index'])->name('index'); // notatki.index = ekran startowy
Route::post('/', [NotatkiController::class, 'store'])->name('store');narzedzia/notatki/src/NotatkiController.php:
PHP
<?php
namespace Narzedzia\Notatki;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class NotatkiController extends Controller
{
public function index()
{
$notatki = DB::table('notatki')->latest()->limit(50)->get();
return view('notatki::index', compact('notatki'));
}
public function store(Request $request)
{
$dane = $request->validate(['tresc' => 'required|string|max:2000']);
DB::table('notatki')->insert([
'user_id' => $request->user()->id,
'tresc' => $dane['tresc'],
'created_at' => now(),
'updated_at' => now(),
]);
return redirect()->route('notatki.index')->with('status', 'Notatka zapisana.');
}
}narzedzia/notatki/widoki/index.blade.php:
Blade
@extends('layouts.app', ['title' => 'Notatki zespołu'])
@section('header', 'Narzędzia')
@section('content')
<div class="ui-page ui-page--szeroka ui-stack">
@include('tools._naglowek', ['nazwa' => 'Notatki zespołu', 'klucz' => 'notatki'])
<form method="POST" action="{{ route('notatki.store') }}" class="ui-card ui-card--flat ui-stack">
@csrf
<div class="ui-field">
<label class="ui-label" for="n-tresc">Nowa notatka</label>
<textarea id="n-tresc" name="tresc" rows="3" class="ui-textarea" maxlength="2000" required></textarea>
</div>
<div><button class="ui-btn ui-btn--primary ui-btn--sm">Zapisz</button></div>
</form>
<div class="ui-card ui-card--flat">
@forelse($notatki as $n)
<p>{{ $n->tresc }}</p>
@empty
<div class="ui-empty"><b>Jeszcze nie ma notatek</b>Dodajcie pierwsz powyej.</div>
@endforelse
</div>
</div>
@endsectionnarzedzia/notatki/migracje/2026_09_25_120000_create_notatki_table.php:
PHP
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('notatki', function (Blueprint $t) {
$t->id();
$t->foreignId('user_id')->nullable()->index();
$t->text('tresc');
$t->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notatki');
}
};Skopiujcie folder do narzedzia/ na instancji testowej, wejdźcie w Administracja › Moduły, otwórzcie „Notatki zespołu” i włączcie. Włączenie samo uruchomi migrację. Ekran jest pod /narzedzia/notatki.
Ostatnia zmiana dokumentacji: 29.09.2026. Pytania: m@redai.pl.