lyrasoft/contact

LYRASOFT contact package

Installs: 7 028

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 1

Open Issues: 4

Type:windwalker-package

1.1.4 2024-07-31 11:53 UTC

This package is auto-updated.

Last update: 2024-10-31 00:23:03 UTC


README

contact

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 to resources/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';
        }
    );