new design
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# Implementation notes
|
||||||
|
|
||||||
|
- Based on `absdev_site.zip` (Laravel 13.17 skeleton).
|
||||||
|
- Added Livewire 4 dependency to composer.json, but removed the stale composer.lock because Composer was not present; `composer install` will regenerate it in the environment.
|
||||||
|
- Added CMS migration, initial section seeder, models, dashboard components, contact form, admin auth and creation command.
|
||||||
|
- Added Tailwind 4 public landing page and administrator UI.
|
||||||
|
- Added tests for page visibility, form submission and honeypot, administrator access and content editing.
|
||||||
|
- Not executed: PHP feature tests or JS build (Composer / vendor dependencies unavailable; npm dependencies not installed).
|
||||||
|
- Before production: install Composer, update lockfile, install dependencies, run migrations, run `php artisan test`, build assets and review the site's content and privacy notice.
|
||||||
@@ -1,58 +1,55 @@
|
|||||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
# ABSDEV — Landing Page & Admin CMS
|
||||||
|
|
||||||
<p align="center">
|
A modern single-page digital studio website built on the **uploaded Laravel 13 starter**, Tailwind CSS 4, Vite and Livewire 4, with a protected content dashboard.
|
||||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
|
||||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
|
||||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
|
||||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## About Laravel
|
## Requirements
|
||||||
|
|
||||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
- PHP 8.3+ with SQLite or MySQL extensions
|
||||||
|
- Composer, Node.js 20+ and npm
|
||||||
|
- Laravel-compatible web server / PHP-FPM
|
||||||
|
|
||||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
## Installation
|
||||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
|
||||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
|
||||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
|
||||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
|
||||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
|
||||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
|
||||||
|
|
||||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
|
||||||
|
|
||||||
## Learning Laravel
|
|
||||||
|
|
||||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
|
||||||
|
|
||||||
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
|
||||||
|
|
||||||
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals.
|
|
||||||
|
|
||||||
## Agentic Development
|
|
||||||
|
|
||||||
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer require laravel/boost --dev
|
cp .env.example .env
|
||||||
|
composer install # generates a fresh composer.lock with Livewire 4
|
||||||
php artisan boost:install
|
php artisan key:generate
|
||||||
|
# Configure DB_* in .env, or use SQLite:
|
||||||
|
mkdir -p database && touch database/database.sqlite
|
||||||
|
php artisan migrate --seed
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
php artisan absdev:create-admin admin@example.com
|
||||||
|
php artisan serve
|
||||||
```
|
```
|
||||||
|
|
||||||
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
|
**Important:** The source archive had no `vendor/` directory and no Livewire dependency. The delivered `composer.json` requires `livewire/livewire:^4.0`. The original lockfile was removed because it did not contain Livewire; `composer install` generates a new lockfile. Commit that regenerated lockfile before deployment. Do not deploy until dependencies are installed, tests pass and assets are built.
|
||||||
|
|
||||||
## Contributing
|
Log in at **`/admin/login`** with the administrator account you created. `absdev:create-admin` securely prompts for a password (minimum 12 characters). There is no public administrator registration route and only `is_admin` users are allowed into `/admin`.
|
||||||
|
|
||||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
## Content management
|
||||||
|
|
||||||
## Code of Conduct
|
- **Overview:** enquiry and section totals, unread messages, recent enquiries and quick actions.
|
||||||
|
- **Page sections:** manage titles, eyebrow text, body copy, buttons, ordering and visibility for hero, services, approach, work and CTA sections. Core layout slots are fixed. New custom section keys are stored but require a Blade template to display.
|
||||||
|
- **Enquiries:** paginated messages with unread filtering, mark-as-read and deletion.
|
||||||
|
- **Site settings:** name, contact email, footer tagline and location.
|
||||||
|
- **Contact form:** Livewire input validation and an anti-spam honeypot; stores messages in the database.
|
||||||
|
|
||||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
## Tests
|
||||||
|
|
||||||
## Security Vulnerabilities
|
```bash
|
||||||
|
php artisan test
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
|
## Security and production notes
|
||||||
|
|
||||||
## License
|
- Configure HTTPS, `APP_ENV=production`, `APP_DEBUG=false`, secure sessions and backups.
|
||||||
|
- The contact form stores personal data. Publish appropriate privacy information and define retention/deletion policies before launch.
|
||||||
|
- No email sending, analytics collection, file/media CMS, role hierarchy or visual page builder is implemented. The dashboard's metrics are genuine database counts only.
|
||||||
|
- Marketing cards and process steps are currently fixed Blade markup; the dashboard edits the major section intro content and visibility. Expand the data model for fully dynamic cards.
|
||||||
|
- Links in the CTA editor are currently user-provided strings; restrict editors to trusted admins.
|
||||||
|
|
||||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
## Package status
|
||||||
|
|
||||||
|
The current execution environment includes PHP and Node.js but not Composer or `vendor/`, so the PHP tests and dependency resolution could not be run here. See `IMPLEMENTATION_NOTES.md` for verification details.
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
class CreateAdmin extends Command {
|
||||||
|
protected $signature='absdev:create-admin {email}';
|
||||||
|
protected $description='Create or promote an administrator (password entered securely)';
|
||||||
|
public function handle(): int {
|
||||||
|
$email=$this->argument('email');
|
||||||
|
if (!filter_var($email,FILTER_VALIDATE_EMAIL)) { $this->error('Invalid email address.'); return self::FAILURE; }
|
||||||
|
$password=$this->secret('Password (minimum 12 characters)');
|
||||||
|
if (!is_string($password) || strlen($password)<12) { $this->error('Password must be at least 12 characters.'); return self::FAILURE; }
|
||||||
|
$user=User::firstOrNew(['email'=>$email]);
|
||||||
|
if (!$user->exists) $user->name=$this->ask('Administrator name','Administrator');
|
||||||
|
$user->password=$password; $user->is_admin=true; $user->save();
|
||||||
|
$this->info('Administrator account ready.'); return self::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
class LoginController extends Controller {
|
||||||
|
public function show() { return view('auth.login'); }
|
||||||
|
public function login(Request $request) {
|
||||||
|
$credentials=$request->validate(['email'=>'required|email','password'=>'required|string']);
|
||||||
|
if (!Auth::attempt([...$credentials,'is_admin'=>true],$request->boolean('remember'))) {
|
||||||
|
throw ValidationException::withMessages(['email'=>'Invalid administrator credentials.']);
|
||||||
|
}
|
||||||
|
$request->session()->regenerate(); return redirect()->intended(route('admin.dashboard'));
|
||||||
|
}
|
||||||
|
public function logout(Request $request) {
|
||||||
|
Auth::logout(); $request->session()->invalidate(); $request->session()->regenerateToken();
|
||||||
|
return redirect()->route('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
class EnsureAdmin {
|
||||||
|
public function handle(Request $request, Closure $next): Response {
|
||||||
|
abort_unless($request->user()?->is_admin,403);
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Livewire\Admin;
|
||||||
|
use App\Models\ContactEnquiry;
|
||||||
|
use App\Models\SiteSection;
|
||||||
|
use App\Models\SiteSetting;
|
||||||
|
use Livewire\Component;
|
||||||
|
class Dashboard extends Component {
|
||||||
|
public function render() {
|
||||||
|
return view('livewire.admin.dashboard', [
|
||||||
|
'totalEnquiries'=>ContactEnquiry::count(), 'unreadEnquiries'=>ContactEnquiry::where('is_read',false)->count(),
|
||||||
|
'sectionCount'=>SiteSection::count(), 'publishedSections'=>SiteSection::where('is_visible',true)->count(),
|
||||||
|
'recentEnquiries'=>ContactEnquiry::latest()->limit(5)->get(),
|
||||||
|
])->layout('layouts.admin', ['title'=>'Overview']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Livewire\Admin;
|
||||||
|
use App\Models\ContactEnquiry;
|
||||||
|
use Livewire\Component;
|
||||||
|
use Livewire\WithPagination;
|
||||||
|
class Enquiries extends Component {
|
||||||
|
use WithPagination;
|
||||||
|
public string $filter='all';
|
||||||
|
public function updatingFilter(): void { $this->resetPage(); }
|
||||||
|
public function markRead(int $id): void { ContactEnquiry::findOrFail($id)->update(['is_read'=>true]); }
|
||||||
|
public function delete(int $id): void { ContactEnquiry::findOrFail($id)->delete(); }
|
||||||
|
public function render() {
|
||||||
|
$query=ContactEnquiry::latest();
|
||||||
|
if ($this->filter==='unread') $query->where('is_read',false);
|
||||||
|
return view('livewire.admin.enquiries',['enquiries'=>$query->paginate(12)])->layout('layouts.admin',['title'=>'Enquiries']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Livewire\Admin;
|
||||||
|
use App\Models\SiteSection;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Livewire\Component;
|
||||||
|
class Sections extends Component {
|
||||||
|
public ?int $editingId = null;
|
||||||
|
public string $key = '';
|
||||||
|
public string $eyebrow = '';
|
||||||
|
public string $title = '';
|
||||||
|
public string $body = '';
|
||||||
|
public string $button_label = '';
|
||||||
|
public string $button_url = '';
|
||||||
|
public bool $is_visible = true;
|
||||||
|
public int $sort_order = 0;
|
||||||
|
public function edit(int $id): void {
|
||||||
|
$s=SiteSection::findOrFail($id);
|
||||||
|
$this->editingId=$s->id;
|
||||||
|
foreach (['key','eyebrow','title','body','button_label','button_url','is_visible','sort_order'] as $field) $this->$field=$s->$field ?? (is_bool($this->$field) ? false : '');
|
||||||
|
}
|
||||||
|
public function add(): void { $this->reset(['editingId','key','eyebrow','title','body','button_label','button_url','sort_order']); $this->is_visible=true; }
|
||||||
|
public function save(): void {
|
||||||
|
$data=$this->validate([
|
||||||
|
'key'=>['required','alpha_dash','max:80', Rule::unique('site_sections','key')->ignore($this->editingId)],
|
||||||
|
'eyebrow'=>'nullable|string|max:255','title'=>'required|string|max:255','body'=>'nullable|string|max:5000',
|
||||||
|
'button_label'=>'nullable|string|max:100','button_url'=>'nullable|string|max:500',
|
||||||
|
'is_visible'=>'boolean','sort_order'=>'integer|min:0|max:999',
|
||||||
|
]);
|
||||||
|
SiteSection::updateOrCreate(['id'=>$this->editingId], $data);
|
||||||
|
$this->add(); session()->flash('status','Section saved successfully.');
|
||||||
|
}
|
||||||
|
public function toggle(int $id): void { $s=SiteSection::findOrFail($id); $s->update(['is_visible'=>!$s->is_visible]); }
|
||||||
|
public function delete(int $id): void { SiteSection::findOrFail($id)->delete(); if ($this->editingId===$id) $this->add(); }
|
||||||
|
public function render() { return view('livewire.admin.sections',['sections'=>SiteSection::orderBy('sort_order')->get()])->layout('layouts.admin',['title'=>'Page sections']); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Livewire\Admin;
|
||||||
|
use App\Models\SiteSetting;
|
||||||
|
use Livewire\Component;
|
||||||
|
class Settings extends Component {
|
||||||
|
public string $site_name=''; public string $email=''; public string $footer_tagline=''; public string $location='';
|
||||||
|
public function mount(): void { foreach (['site_name','email','footer_tagline','location'] as $key) $this->$key=SiteSetting::where('key',$key)->value('value') ?? ''; }
|
||||||
|
public function save(): void {
|
||||||
|
$data=$this->validate(['site_name'=>'required|string|max:100','email'=>'required|email|max:255',
|
||||||
|
'footer_tagline'=>'nullable|string|max:255','location'=>'nullable|string|max:255']);
|
||||||
|
foreach ($data as $key=>$value) SiteSetting::updateOrCreate(['key'=>$key],['value'=>$value]);
|
||||||
|
session()->flash('status','Settings updated.');
|
||||||
|
}
|
||||||
|
public function render() { return view('livewire.admin.settings')->layout('layouts.admin',['title'=>'Site settings']); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Livewire;
|
||||||
|
use App\Models\ContactEnquiry;
|
||||||
|
use Livewire\Component;
|
||||||
|
class ContactForm extends Component {
|
||||||
|
public string $name = '';
|
||||||
|
public string $email = '';
|
||||||
|
public string $company = '';
|
||||||
|
public string $service = '';
|
||||||
|
public string $message = '';
|
||||||
|
public string $website = '';
|
||||||
|
public bool $submitted = false;
|
||||||
|
public function submit(): void {
|
||||||
|
$this->validate(['name'=>'required|string|max:120','email'=>'required|email|max:255','company'=>'nullable|string|max:120',
|
||||||
|
'service'=>'nullable|string|max:100','message'=>'required|string|min:10|max:5000','website'=>'nullable|max:0']);
|
||||||
|
ContactEnquiry::create($this->only(['name','email','company','service','message']));
|
||||||
|
$this->reset(['name','email','company','service','message']);
|
||||||
|
$this->submitted = true;
|
||||||
|
}
|
||||||
|
public function render() { return view('livewire.contact-form'); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
class ContactEnquiry extends Model {
|
||||||
|
protected $fillable = ['name','email','company','service','message','is_read'];
|
||||||
|
protected function casts(): array { return ['is_read'=>'boolean']; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
class SiteSection extends Model {
|
||||||
|
protected $fillable = ['key','eyebrow','title','body','button_label','button_url','is_visible','sort_order'];
|
||||||
|
protected function casts(): array { return ['is_visible'=>'boolean','sort_order'=>'integer']; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
class SiteSetting extends Model { protected $fillable = ['key','value']; }
|
||||||
+2
-1
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
#[Fillable(['name', 'email', 'password'])]
|
#[Fillable(['name', 'email', 'password', 'is_admin'])]
|
||||||
#[Hidden(['password', 'remember_token'])]
|
#[Hidden(['password', 'remember_token'])]
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
@@ -27,6 +27,7 @@ class User extends Authenticatable
|
|||||||
return [
|
return [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'password' => 'hashed',
|
'password' => 'hashed',
|
||||||
|
'is_admin' => 'boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -3,12 +3,16 @@
|
|||||||
"name": "laravel/laravel",
|
"name": "laravel/laravel",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The skeleton application for the Laravel framework.",
|
"description": "The skeleton application for the Laravel framework.",
|
||||||
"keywords": ["laravel", "framework"],
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"framework"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.3",
|
"php": "^8.3",
|
||||||
"laravel/framework": "^13.17",
|
"laravel/framework": "^13.17",
|
||||||
"laravel/tinker": "^3.0"
|
"laravel/tinker": "^3.0",
|
||||||
|
"livewire/livewire": "^4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
|
|||||||
Generated
+188
-222
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
<?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::table('users', fn (Blueprint $table) => $table->boolean('is_admin')->default(false));
|
||||||
|
Schema::create('site_sections', function (Blueprint $table) {
|
||||||
|
$table->id(); $table->string('key')->unique(); $table->string('eyebrow')->nullable();
|
||||||
|
$table->string('title'); $table->text('body')->nullable(); $table->string('button_label')->nullable();
|
||||||
|
$table->string('button_url')->nullable(); $table->boolean('is_visible')->default(true);
|
||||||
|
$table->unsignedInteger('sort_order')->default(0); $table->timestamps();
|
||||||
|
});
|
||||||
|
Schema::create('site_settings', function (Blueprint $table) {
|
||||||
|
$table->id(); $table->string('key')->unique(); $table->text('value')->nullable(); $table->timestamps();
|
||||||
|
});
|
||||||
|
Schema::create('contact_enquiries', function (Blueprint $table) {
|
||||||
|
$table->id(); $table->string('name'); $table->string('email'); $table->string('company')->nullable();
|
||||||
|
$table->string('service')->nullable(); $table->text('message'); $table->boolean('is_read')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public function down(): void {
|
||||||
|
Schema::dropIfExists('contact_enquiries'); Schema::dropIfExists('site_settings');
|
||||||
|
Schema::dropIfExists('site_sections'); Schema::table('users', fn (Blueprint $table) => $table->dropColumn('is_admin'));
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,25 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
class DatabaseSeeder extends Seeder { public function run(): void { $this->call(SiteContentSeeder::class); } }
|
||||||
class DatabaseSeeder extends Seeder
|
|
||||||
{
|
|
||||||
use WithoutModelEvents;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Seed the application's database.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
// User::factory(10)->create();
|
|
||||||
|
|
||||||
User::factory()->create([
|
|
||||||
'name' => 'Test User',
|
|
||||||
'email' => '[email protected]',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace Database\Seeders;
|
||||||
|
use App\Models\SiteSection;
|
||||||
|
use App\Models\SiteSetting;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
class SiteContentSeeder extends Seeder {
|
||||||
|
public function run(): void {
|
||||||
|
$sections = [
|
||||||
|
['hero','Independent by design. Exceptional by default.','Digital experiences built to move your business forward.','We craft considered software, polished websites, and practical digital products for ambitious businesses. From the first sketch to the final deployment, every detail matters.','Start a project','#contact'],
|
||||||
|
['services','WHAT WE DO','Technology with a human touch.','Strategy, design and engineering working together. Modern tools, clear thinking and software that genuinely earns its place.','Explore our services','#services'],
|
||||||
|
['approach','HOW WE WORK','Small team energy. Big picture thinking.','Direct collaboration, honest communication and a relentless focus on outcomes. We keep projects agile, transparent and built for the long term.','Our process','#process'],
|
||||||
|
['work','SELECTED EXPERTISE','From complex challenges to elegant solutions.','We turn real-world problems into streamlined systems, thoughtful products and reliable digital infrastructure.','Talk about your idea','#contact'],
|
||||||
|
['cta','LET’S BUILD SOMETHING','Your next chapter starts with a conversation.','Tell us what you are building. We will help map out the smartest way forward.','Get in touch','#contact'],
|
||||||
|
];
|
||||||
|
foreach ($sections as $i => [$key,$eyebrow,$title,$body,$button,$url]) {
|
||||||
|
SiteSection::firstOrCreate(['key'=>$key], ['eyebrow'=>$eyebrow,'title'=>$title,'body'=>$body,'button_label'=>$button,'button_url'=>$url,'sort_order'=>$i]);
|
||||||
|
}
|
||||||
|
foreach (['site_name'=>'ABSDEV','email'=>'[email protected]','footer_tagline'=>'Independent software. Thoughtfully engineered.','location'=>'United Kingdom'] as $key=>$value) {
|
||||||
|
SiteSetting::firstOrCreate(['key'=>$key], ['value'=>$value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+2316
File diff suppressed because it is too large
Load Diff
+28
-6
@@ -1,9 +1,31 @@
|
|||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
|
|
||||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||||
@source '../../storage/framework/views/*.php';
|
@source '../views/**/*.blade.php';
|
||||||
|
@theme { --color-ink: #07131f; --color-acid: #c7f36b; --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif; }
|
||||||
@theme {
|
@layer base { html { scroll-behavior: smooth; } body { font-family: var(--font-sans); } ::selection { background:#c7f36b; color:#07131f; } }
|
||||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
@layer components {
|
||||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
.container-wide { @apply mx-auto w-full max-w-[1320px] px-6 md:px-10 xl:px-14; }
|
||||||
|
.section-padding { @apply py-24 md:py-32; }
|
||||||
|
.heading-2 { @apply max-w-[650px] text-[clamp(2.6rem,4.5vw,4.6rem)] font-semibold tracking-[-.055em] leading-[1.12]; }
|
||||||
|
.section-heading { @apply flex flex-col justify-between gap-8 md:flex-row md:items-end; }
|
||||||
|
.eyebrow { @apply inline-flex items-center gap-3 text-[11px] font-bold uppercase tracking-[.25em] text-acid; }
|
||||||
|
.status-dot { @apply size-2 rounded-full bg-acid shadow-[0_0_16px_#c7f36b]; }
|
||||||
|
.button-acid { @apply inline-flex items-center justify-center gap-9 rounded-full bg-acid px-7 py-4 text-[13px] font-bold text-ink transition hover:bg-white; }
|
||||||
|
.button-outline { @apply items-center gap-5 rounded-full border border-white/25 px-6 py-3.5 text-xs font-bold transition hover:border-acid hover:text-acid; }
|
||||||
|
.brand-mark { @apply flex size-10 items-center justify-center rounded-xl bg-white/10 text-xl font-extrabold; }
|
||||||
|
.nav-link { @apply transition hover:text-acid; }
|
||||||
|
.mini-panel { @apply flex flex-col gap-3 rounded-xl bg-white/5 px-3 py-4 text-[10px] text-slate-300; }
|
||||||
|
.service-card { @apply min-h-72 rounded-2xl border border-white/10 bg-white/[.025] p-8 transition duration-300 hover:-translate-y-1 hover:border-acid/40 hover:bg-white/[.055]; }
|
||||||
|
.work-card { @apply overflow-hidden rounded-[24px] border border-white/10 bg-[#0a1622]; }
|
||||||
|
.work-visual { @apply flex h-72 items-center justify-center overflow-hidden p-8; }
|
||||||
|
.field-label { @apply mb-2 block text-xs font-semibold text-slate-300; }
|
||||||
|
.field-input { @apply block w-full rounded-xl border border-white/15 bg-[#0b1926] px-4 py-3.5 text-sm text-white outline-none transition focus:border-acid; }
|
||||||
|
.field-error { @apply mt-2 text-xs text-red-300; }
|
||||||
|
.admin-input { @apply block w-full rounded-xl border border-slate-200 bg-white px-4 py-3 text-sm text-slate-900 outline-none focus:border-teal-500; }
|
||||||
|
.admin-label { @apply mb-2 block text-xs font-semibold uppercase tracking-wider text-slate-500; }
|
||||||
|
.admin-card { @apply rounded-2xl border border-slate-200 bg-white p-6 shadow-sm; }
|
||||||
|
.admin-nav { @apply rounded-xl px-4 py-3 text-sm font-medium text-slate-300 transition hover:bg-white/10 hover:text-white; }
|
||||||
|
.admin-button { @apply rounded-xl bg-[#102b38] px-5 py-3 text-sm font-semibold text-white transition hover:bg-[#1c5661]; }
|
||||||
}
|
}
|
||||||
|
.hero-grid { background-image:linear-gradient(to right,rgba(148,163,184,.055) 1px,transparent 1px),linear-gradient(to bottom,rgba(148,163,184,.055) 1px,transparent 1px);background-size:60px 60px; mask-image:linear-gradient(to bottom,black,transparent 95%); }
|
||||||
|
.hero-glow { background:radial-gradient(ellipse at 78% 48%,rgba(16,95,111,.23),transparent 48%),#07131f; }
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex"><title>Admin sign in — ABSDEV</title>@vite(['resources/css/app.css','resources/js/app.js'])</head><body class="flex min-h-screen items-center justify-center bg-[#07131f] px-6 py-12"><div class="w-full max-w-md"><a href="/" class="text-3xl font-extrabold tracking-widest text-white">ABSDEV<span class="text-acid">.</span></a><div class="mt-10 rounded-3xl border border-white/10 bg-[#0e2332] p-8"><div class="text-xs font-semibold uppercase tracking-widest text-acid">Secure access</div><h1 class="mt-3 text-3xl font-bold text-white">Welcome back.</h1><p class="mt-3 text-sm text-slate-400">Sign in to manage your website.</p><form method="POST" action="{{ route('login.submit') }}" class="mt-9 space-y-5">@csrf<div><label for="email" class="field-label">Email address</label><input class="field-input" type="email" id="email" name="email" autocomplete="username" value="{{ old('email') }}" required autofocus>@error('email')<p class="field-error">{{ $message }}</p>@enderror</div><div><label for="password" class="field-label">Password</label><input class="field-input" type="password" id="password" name="password" autocomplete="current-password" required></div><label class="flex items-center gap-3 text-sm text-slate-400"><input type="checkbox" name="remember" value="1"> Remember me</label><button class="button-acid w-full" type="submit">Sign in →</button></form></div><p class="mt-8 text-center text-xs text-slate-500">Administrator accounts are provisioned via the command line.</p></div></body></html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex,nofollow"><title>{{ $title ?? 'Dashboard' }} — ABSDEV Admin</title>@vite(['resources/css/app.css','resources/js/app.js']) @livewireStyles</head><body class="min-h-screen bg-[#f3f6f8] font-sans text-[#142e3c]"><div class="min-h-screen lg:flex"><aside class="w-full shrink-0 bg-[#09212e] p-7 text-white lg:min-h-screen lg:w-64"><a href="{{ route('admin.dashboard') }}" class="text-2xl font-bold tracking-widest">ABSDEV<span class="text-acid">.</span></a><div class="mt-3 text-xs font-semibold uppercase tracking-[.2em] text-slate-400">Control centre</div><nav class="mt-12 flex flex-wrap gap-2 lg:flex-col" aria-label="Admin menu"><a href="{{ route('admin.dashboard') }}" class="admin-nav {{ request()->routeIs('admin.dashboard') ? 'bg-white/15 text-acid' : '' }}">◫ Overview</a><a href="{{ route('admin.sections') }}" class="admin-nav {{ request()->routeIs('admin.sections') ? 'bg-white/15 text-acid' : '' }}">▤ Page sections</a><a href="{{ route('admin.enquiries') }}" class="admin-nav {{ request()->routeIs('admin.enquiries') ? 'bg-white/15 text-acid' : '' }}">✉ Enquiries</a><a href="{{ route('admin.settings') }}" class="admin-nav {{ request()->routeIs('admin.settings') ? 'bg-white/15 text-acid' : '' }}">⚙ Site settings</a><a href="{{ route('home') }}" target="_blank" rel="noopener" class="admin-nav">↗ View website</a></nav><div class="mt-12 border-t border-white/10 pt-6 text-sm text-slate-400"><div class="truncate">{{ auth()->user()->email }}</div><form method="POST" action="{{ route('logout') }}" class="mt-4">@csrf<button type="submit" class="text-acid hover:underline">Sign out ↗</button></form></div></aside><div class="min-w-0 flex-1"><header class="border-b border-slate-200 bg-white px-6 py-6 md:px-10"><div class="mx-auto flex max-w-6xl items-center justify-between gap-4"><div><span class="text-xs font-semibold uppercase tracking-widest text-teal-600">Website administration</span><h1 class="mt-1 text-2xl font-bold tracking-tight">{{ $title ?? 'Dashboard' }}</h1></div><div class="hidden rounded-full bg-emerald-50 px-4 py-2 text-xs font-semibold text-emerald-700 sm:block">● Admin access</div></div></header><main class="mx-auto max-w-6xl space-y-7 p-6 md:p-10">{{ $slot }}</main></div></div>@livewireScripts</body></html>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#07121d"><meta name="description" content="ABSDEV — independent software development, digital experiences and technology consultancy."><title>{{ $pageTitle ?? 'ABSDEV — Independent digital studio' }}</title>
|
||||||
|
@vite(['resources/css/app.css','resources/js/app.js']) @livewireStyles</head>
|
||||||
|
<body class="bg-ink text-white antialiased">{{ $slot ?? '' }} @yield('content') @livewireScripts</body></html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<div class="space-y-8"><div class="grid gap-5 sm:grid-cols-2 xl:grid-cols-4">@foreach([['Total enquiries',$totalEnquiries,'↗'],['Unread messages',$unreadEnquiries,'✉'],['Content sections',$sectionCount,'▤'],['Published sections',$publishedSections,'●']] as $stat)<div class="admin-card"><div class="flex items-center justify-between"><span class="text-sm font-medium text-slate-500">{{ $stat[0] }}</span><span class="text-xl text-teal-600">{{ $stat[2] }}</span></div><div class="mt-5 text-4xl font-bold tracking-tight">{{ $stat[1] }}</div></div>@endforeach</div><div class="grid gap-6 xl:grid-cols-[1.5fr_1fr]"><div class="admin-card"><div class="mb-6 flex items-center justify-between"><h2 class="text-lg font-bold">Recent enquiries</h2><a class="text-sm font-semibold text-teal-700" href="{{ route('admin.enquiries') }}">View all →</a></div><div class="divide-y divide-slate-100">@forelse($recentEnquiries as $enquiry)<div class="flex flex-wrap justify-between gap-3 py-4"><div><p class="font-semibold">{{ $enquiry->name }} <span class="ml-2 text-xs font-normal text-slate-500">{{ $enquiry->company }}</span></p><p class="mt-1 text-xs text-slate-500">{{ $enquiry->email }} · {{ $enquiry->service ?: 'General enquiry' }}</p></div><div class="text-xs text-slate-400">{{ $enquiry->created_at->diffForHumans() }}</div></div>@empty<p class="py-6 text-sm text-slate-500">No enquiries yet. Messages from your landing page will appear here.</p>@endforelse</div></div><div class="admin-card"><h2 class="text-lg font-bold">Quick actions</h2><p class="mt-2 text-sm leading-7 text-slate-500">Keep your content current and respond to new business opportunities.</p><div class="mt-8 grid gap-3"><a class="admin-button text-center" href="{{ route('admin.sections') }}">Edit landing page</a><a class="admin-button text-center" href="{{ route('admin.enquiries') }}">Manage enquiries</a><a class="rounded-xl border border-slate-200 p-3 text-center text-sm font-semibold" href="{{ route('home') }}" target="_blank" rel="noopener">Preview website ↗</a></div></div></div></div>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<div class="space-y-6"><div class="admin-card"><div class="flex flex-wrap items-center justify-between gap-4"><div><h2 class="text-lg font-bold">Contact enquiries</h2><p class="mt-1 text-sm text-slate-500">Messages submitted through the public landing page.</p></div><select wire:model.live="filter" class="admin-input max-w-44"><option value="all">All enquiries</option><option value="unread">Unread only</option></select></div><div class="mt-6 space-y-4">@forelse($enquiries as $enquiry)<article wire:key="enquiry-{{ $enquiry->id }}" class="rounded-xl border border-slate-200 p-5"><div class="flex flex-wrap justify-between gap-4"><div><h3 class="font-bold">{{ $enquiry->name }} <span class="ml-2 text-sm font-normal text-slate-500">{{ $enquiry->company }}</span></h3><div class="mt-2 text-xs text-slate-500"><a href="mailto:{{ $enquiry->email }}" class="text-teal-700">{{ $enquiry->email }}</a> · {{ $enquiry->service ?: 'General' }} · {{ $enquiry->created_at->format('d M Y H:i') }}</div></div><div class="flex items-center gap-3">@unless($enquiry->is_read)<span class="rounded-full bg-amber-100 px-2 py-1 text-xs text-amber-800">Unread</span><button wire:click="markRead({{ $enquiry->id }})" class="text-xs font-semibold text-teal-700">Mark read</button>@endunless<button wire:click="delete({{ $enquiry->id }})" wire:confirm="Permanently delete this enquiry?" class="text-xs font-semibold text-red-600">Delete</button></div></div><p class="mt-5 whitespace-pre-wrap text-sm leading-7 text-slate-700">{{ $enquiry->message }}</p></article>@empty<p class="py-10 text-center text-sm text-slate-500">No enquiries found.</p>@endforelse</div><div class="mt-6">{{ $enquiries->links() }}</div></div></div>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<div class="space-y-7">@if(session('status'))<div class="rounded-xl bg-emerald-50 p-4 text-sm text-emerald-700" role="status">{{ session('status') }}</div>@endif<div class="admin-card"><div class="flex flex-wrap items-center justify-between gap-4"><div><h2 class="text-lg font-bold">Content management</h2><p class="mt-1 text-sm text-slate-500">Edit text, calls to action, visibility and display order.</p></div><button class="admin-button" wire:click="add">+ New section</button></div><div class="mt-6 divide-y divide-slate-100">@foreach($sections as $section)<div wire:key="section-{{ $section->id }}" class="flex flex-wrap items-center justify-between gap-3 py-4"><div><span class="text-xs font-mono text-slate-400">{{ $section->sort_order }} / {{ $section->key }}</span><p class="mt-1 font-semibold">{{ $section->title }}</p></div><div class="flex flex-wrap items-center gap-3"><span class="text-xs {{ $section->is_visible ? 'text-emerald-700' : 'text-slate-400' }}">{{ $section->is_visible ? 'Published' : 'Hidden' }}</span><button wire:click="toggle({{ $section->id }})" class="text-xs font-semibold text-teal-700">Toggle</button><button wire:click="edit({{ $section->id }})" class="text-xs font-semibold text-teal-700">Edit</button><button wire:click="delete({{ $section->id }})" wire:confirm="Delete this section?" class="text-xs font-semibold text-red-600">Delete</button></div></div>@endforeach</div></div><div class="admin-card"><h2 class="text-lg font-bold">{{ $editingId ? 'Edit section' : 'Add section' }}</h2><p class="mt-1 text-xs text-slate-500">The five core layout slots are hero, services, approach, work and cta. Additional custom keys are stored for future layouts.</p><form wire:submit="save" class="mt-7 grid gap-5 md:grid-cols-2"><div><label class="admin-label">Section key *</label><input wire:model="key" class="admin-input" required>@error('key')<p class="field-error">{{ $message }}</p>@enderror</div><div><label class="admin-label">Order</label><input type="number" wire:model="sort_order" min="0" class="admin-input"></div><div><label class="admin-label">Eyebrow</label><input wire:model="eyebrow" class="admin-input"></div><div><label class="admin-label">Title *</label><input wire:model="title" class="admin-input" required>@error('title')<p class="field-error">{{ $message }}</p>@enderror</div><div class="md:col-span-2"><label class="admin-label">Body</label><textarea wire:model="body" rows="5" class="admin-input"></textarea></div><div><label class="admin-label">Button label</label><input wire:model="button_label" class="admin-input"></div><div><label class="admin-label">Button URL</label><input wire:model="button_url" class="admin-input" placeholder="#contact or /contact"></div><div class="md:col-span-2"><label class="flex items-center gap-3 text-sm"><input type="checkbox" wire:model="is_visible"> Publish this section</label></div><div class="md:col-span-2"><button class="admin-button" type="submit">Save section</button></div></form></div></div>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<div class="admin-card max-w-3xl">@if(session('status'))<div class="mb-6 rounded-xl bg-emerald-50 p-4 text-sm text-emerald-700" role="status">{{ session('status') }}</div>@endif<h2 class="text-lg font-bold">General website settings</h2><p class="mt-2 text-sm text-slate-500">Change the contact details and brand text displayed on the landing page.</p><form wire:submit="save" class="mt-8 space-y-6"><div><label class="admin-label">Site name</label><input wire:model="site_name" class="admin-input">@error('site_name')<p class="field-error">{{ $message }}</p>@enderror</div><div><label class="admin-label">Public contact email</label><input type="email" wire:model="email" class="admin-input">@error('email')<p class="field-error">{{ $message }}</p>@enderror</div><div><label class="admin-label">Footer tagline</label><input wire:model="footer_tagline" class="admin-input"></div><div><label class="admin-label">Location</label><input wire:model="location" class="admin-input"></div><button class="admin-button" type="submit">Save settings</button></form></div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="rounded-3xl border border-white/10 bg-white/[.035] p-7 md:p-10">
|
||||||
|
@if($submitted)<div class="rounded-xl border border-acid/30 bg-acid/10 px-5 py-4 text-acid" role="status">Thank you — your enquiry has been received. We will get back to you.</div>@else
|
||||||
|
<form wire:submit="submit" class="grid gap-6 md:grid-cols-2"><div><label class="field-label" for="contact-name">Your name *</label><input id="contact-name" wire:model="name" class="field-input" autocomplete="name" required>@error('name')<p class="field-error">{{ $message }}</p>@enderror</div><div><label class="field-label" for="contact-email">Email address *</label><input id="contact-email" wire:model="email" class="field-input" type="email" autocomplete="email" required>@error('email')<p class="field-error">{{ $message }}</p>@enderror</div><div><label class="field-label" for="contact-company">Company</label><input id="contact-company" wire:model="company" class="field-input" autocomplete="organization"></div><div><label class="field-label" for="contact-service">I'm interested in</label><select id="contact-service" wire:model="service" class="field-input"><option value="">Select a service</option><option>Web development</option><option>macOS / iOS app</option><option>Systems & integrations</option><option>UI / UX design</option><option>Consultancy</option><option>Other</option></select></div><div class="md:col-span-2"><label class="field-label" for="contact-message">Tell us about your project *</label><textarea id="contact-message" wire:model="message" class="field-input min-h-36" required minlength="10" maxlength="5000" placeholder="What are you looking to build?"></textarea>@error('message')<p class="field-error">{{ $message }}</p>@enderror</div><div class="hidden" aria-hidden="true"><label for="website">Website</label><input id="website" wire:model="website" tabindex="-1" autocomplete="off"></div><div class="md:col-span-2 flex flex-wrap items-center justify-between gap-4"><p class="text-xs text-slate-500">Your details are only used to respond to your enquiry.</p><button type="submit" class="button-acid" wire:loading.attr="disabled">Send enquiry <span>↗</span></button></div></form>@endif</div>
|
||||||
File diff suppressed because one or more lines are too long
+23
-2
@@ -1,7 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use App\Http\Controllers\Auth\LoginController;
|
||||||
|
use App\Http\Middleware\EnsureAdmin;
|
||||||
|
use App\Livewire\Admin\Dashboard;
|
||||||
|
use App\Livewire\Admin\Enquiries;
|
||||||
|
use App\Livewire\Admin\Sections;
|
||||||
|
use App\Livewire\Admin\Settings;
|
||||||
|
use App\Models\SiteSection;
|
||||||
|
use App\Models\SiteSetting;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome', [
|
||||||
|
'sections'=>SiteSection::where('is_visible',true)->orderBy('sort_order')->get()->keyBy('key'),
|
||||||
|
'settings'=>SiteSetting::pluck('value','key'),
|
||||||
|
]);
|
||||||
|
})->name('home');
|
||||||
|
Route::middleware('guest')->group(function () {
|
||||||
|
Route::get('/admin/login',[LoginController::class,'show'])->name('login');
|
||||||
|
Route::post('/admin/login',[LoginController::class,'login'])->middleware('throttle:5,1')->name('login.submit');
|
||||||
|
});
|
||||||
|
Route::post('/admin/logout',[LoginController::class,'logout'])->middleware('auth')->name('logout');
|
||||||
|
Route::prefix('admin')->name('admin.')->middleware(['auth',EnsureAdmin::class])->group(function () {
|
||||||
|
Route::get('/',Dashboard::class)->name('dashboard');
|
||||||
|
Route::get('/sections',Sections::class)->name('sections');
|
||||||
|
Route::get('/enquiries',Enquiries::class)->name('enquiries');
|
||||||
|
Route::get('/settings',Settings::class)->name('settings');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
*
|
|
||||||
!data/
|
|
||||||
!locks/
|
|
||||||
!.gitignore
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace Tests\Feature;
|
||||||
|
use App\Livewire\ContactForm;
|
||||||
|
use App\Livewire\Admin\Sections;
|
||||||
|
use App\Models\ContactEnquiry;
|
||||||
|
use App\Models\SiteSection;
|
||||||
|
use App\Models\User;
|
||||||
|
use Database\Seeders\SiteContentSeeder;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use Tests\TestCase;
|
||||||
|
class SiteExperienceTest extends TestCase {
|
||||||
|
use RefreshDatabase;
|
||||||
|
public function test_homepage_displays_published_content(): void {
|
||||||
|
$this->seed(SiteContentSeeder::class);
|
||||||
|
$this->get('/')->assertOk()->assertSee('Digital experiences built to move your business forward.');
|
||||||
|
SiteSection::where('key','hero')->update(['is_visible'=>false]);
|
||||||
|
$this->get('/')->assertOk()->assertDontSee('Digital experiences built to move your business forward.');
|
||||||
|
}
|
||||||
|
public function test_contact_form_validates_and_saves_enquiry(): void {
|
||||||
|
Livewire::test(ContactForm::class)->set('name','Test Client')->set('email','[email protected]')
|
||||||
|
->set('message','Please build a Laravel website for my business.')->call('submit')->assertHasNoErrors();
|
||||||
|
$this->assertDatabaseHas('contact_enquiries',['email'=>'[email protected]','is_read'=>false]);
|
||||||
|
}
|
||||||
|
public function test_guests_cannot_open_admin_dashboard(): void { $this->get('/admin')->assertRedirect(route('login')); }
|
||||||
|
public function test_non_admin_cannot_access_admin_pages(): void {
|
||||||
|
$this->actingAs(User::factory()->create())->get('/admin')->assertForbidden();
|
||||||
|
}
|
||||||
|
public function test_admin_can_edit_site_content(): void {
|
||||||
|
$admin=User::factory()->create(['is_admin'=>true]); $this->actingAs($admin);
|
||||||
|
Livewire::test(Sections::class)->set('key','hero')->set('title','A better digital future')
|
||||||
|
->set('body','Custom messaging')->set('is_visible',true)->call('save')->assertHasNoErrors();
|
||||||
|
$this->assertDatabaseHas('site_sections',['key'=>'hero','title'=>'A better digital future']);
|
||||||
|
}
|
||||||
|
public function test_honeypot_rejects_spam(): void {
|
||||||
|
Livewire::test(ContactForm::class)->set('name','Spam')->set('email','[email protected]')
|
||||||
|
->set('message','Spam message example')->set('website','spambot')->call('submit')->assertHasErrors(['website']);
|
||||||
|
$this->assertSame(0,ContactEnquiry::count());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user