Files
ntspi-app/database/factories/EventFactory.php
T
F4ilji d6c0f48d48 feat(analytics): add site analytics with grouped navigation sections
- Add Analytics container: models, tasks, jobs, controllers, routes, services
- Add analytics config with section groups (structure, institute, content, services)
- Add database tables: analytics_sessions, analytics_hits, analytics_daily_stats
- Add frontend: Analytics page, section detail, chart, overview, navigation components
- Add consent banner and JS tracking service (sendBeacon + Inertia listener)
- Add permission sync for view_analytics, view_any_analytic
- Fix trailing slash URL matching in GetNavigationSectionsTask
- Fix event propagation on expand arrows in navigation sections
- Fix RecordVisitJob to not depend on dropped analytics_geo_cache table
- Replace plain text views/visitors with badge-style icons
- Group navigation sections by category with separate blocks
- Add config-driven non-CMS sections (faculties, divisions, DPO, journals)
- Remove Events, TV, Sveden from analytics sections
2026-09-18 22:18:04 +05:00

48 lines
1.7 KiB
PHP
Executable File

<?php
namespace Database\Factories;
use App\Containers\Event\Models\EventCategory;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class EventFactory extends Factory
{
protected $model = \App\Containers\Event\Models\Event::class;
public function definition(): array
{
$title = $this->faker->sentence;
$content = array_map(function () {
return [
'type' => $this->faker->randomElement(['heading', 'paragraph']),
'data' => [
'id' => $this->faker->numberBetween(1, 1000000),
'content' => $this->faker->paragraph,
],
];
}, range(1, $this->faker->numberBetween(1, 5)));
$eventDateStart = $this->faker->dateTimeBetween('-6 months', 'now');
$endDate = date('Y-m-d', strtotime($eventDateStart->format('Y-m-d') . ' +' . rand(1, 30) . ' days'));
$eventDateEnd = $this->faker->optional(0.5)->dateTimeBetween(
$eventDateStart->format('Y-m-d'),
$endDate
);
return [
'title' => $title,
'slug' => Str::slug($title),
'content' => $content,
'event_date_start' => $eventDateStart->format('Y-m-d'),
'event_date_end' => $eventDateEnd?->format('Y-m-d'),
'event_time_start' => $this->faker->time('H:i'),
'address' => $this->faker->address,
'is_online' => $this->faker->boolean,
'category_id' => EventCategory::factory(),
'created_at' => $this->faker->dateTimeBetween('-6 months', 'now'),
'updated_at' => $this->faker->dateTimeBetween('-6 months', 'now'),
];
}
}