krafthaus/bauhausblock
Laravel package for building “Bauhaus” content blocks/components for your app or CMS. Provides a structured way to define, render, and manage reusable blocks, helping you compose pages from modular content with minimal setup.
blocks table) must align with existing migrations. Potential conflicts if the app already uses a custom block system.BlockServiceProvider) suggest flexibility, but lacks documentation on event-driven extensions (e.g., block updates triggering side effects).@foreach($blocks as $block)), which may necessitate adjustments to existing Blade templates.sort_order column vs. array-based).data column).composer.json).@include or dynamic partials.GET /api/blocks/{page_id}) with Laravel’s Route::resource.blocks table with columns: id, page_id, type, data (JSON), sort_order, created_at.Schema::create('blocks', function (Blueprint $table) {
$table->id();
$table->foreignId('page_id')->constrained()->cascadeOnDelete();
$table->string('type');
$table->json('data');
$table->integer('sort_order');
$table->timestamps();
});
BlockServiceProvider in config/app.php.Block::extend().@foreach($page->blocks as $block)
@include("blocks.{$block->type}", ['block' => $block])
@endforeach
BlockController to expose CRUD endpoints for frontend consumption.spatie/laravel-activitylog for block auditing).HeroBlock, TestimonialBlock).Cache::remember for block collections).BlockServiceProvider modifications.TextBlock).published_at) would require migrations.spatie/laravel-medialibrary (for media-heavy blocks) or orchid/software (for admin panels).$page->load('blocks');
$blocks = Block::where('page_id', $page->id)->paginate(20);
Cache::remember("blocks.{$page->id}", now()->addHours(1), fn() => $page->blocks);
version column to blocks table if needed.data column (JSON) could break rendering. Validate with:
$block->update(['data' => json_encode($validatedData)]);
sort_order could disrupt block ordering. Default to 0 in migrations.@include("blocks.{$block->type}")) will fail silently. Use @if(file_exists(...)) guards.BlockController:
public function update(Request $request, Block $block) {
$this->authorize('update', $block);
// ...
}
How can I help you explore Laravel packages today?