lyrasoft / contact
LYRASOFT contact package
Installs: 7 260
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 4
Type:windwalker-package
Requires
- php: >=8.2
- lyrasoft/luna: ^2.0
This package is auto-updated.
Last update: 2024-12-01 00:16:47 UTC
README
Installation
Install from composer
composer require lyrasoft/contact
Then copy files to project
php windwalker pkg:install lyrasoft/contact -t routes -t lang -t migrations -t seeders
Seeders
- Add
contact-seeder.php
toresources/seeders/main.php
Languages
If you don't want to copy language files, remove -t lang
from install command.
Then add this line to admin & front middleware:
$this->lang->loadAllFromVendor(\Lyrasoft\Contact\ContactPackage::class, 'ini');
Register Admin Menu
Edit resources/menu/admin/sidemenu.menu.php
// Contact $menu->link('聯絡單') ->to($nav->to('contact_list', ['type' => 'main'])) ->icon('fal fa-phone-volume');
Support Multiple Types
Use Route to separate types:
/admin/contact/list/{type}
Use type
param in Navigator.
$nav->to('contact_list', ['type' => '{type}']);
Frontend
One MVC per type. If you want another contact form with type: foo
, just generate a FooContact
MVC
php windwalker g controller Admin/FooContact php windwalker g view Admin/FooContact php windwalker g form Admin/FooContact/Form/EditForm
And remember set type when saving in controller:
$controller->prepareSave( function (PrepareSaveEvent $event) { $data = &$event->getData(); $data['type'] = 'foo'; } );