webpress / dynamic-contact-form
Dynamic-Contact-Form Package for Laravel
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 807
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- webpress/core: ^3.1
Requires (Dev)
- orchestra/testbench: 5.0.0
- phpunit/phpunit: 8.5.13
- spatie/phpunit-watcher: 1.23.0
- dev-master
- 3.1.87
- 3.1.86
- 3.1.85
- 3.1.83
- 3.1.82
- 3.1.81
- 3.1.80
- 3.1.79
- 3.1.78
- 3.1.77
- 3.1.76
- 3.1.74
- 3.1.73
- 3.1.72
- 3.1.71
- 3.1.70
- 3.1.69
- 3.1.68
- 3.1.67
- 3.1.66
- 3.1.65
- 3.1.64
- 3.1.63
- 3.1.61
- 3.1.60
- 3.1.59
- 3.1.58
- 3.1.57
- 3.1.56
- 3.1.54
- 3.1.53
- 3.1.52
- 3.1.51
- 3.1.50
- 3.1.49
- 3.1.48
- 3.1.47
- 3.1.46
- 3.1.45
- 3.1.44
- 3.1.43
- 3.1.42
- 3.1.41
- 3.1.40
- 3.1.39
- 3.1.38
- 3.1.37
- 3.1.36
- 3.1.35
- 3.1.34
- 3.1.33
- 3.1.32
- 3.1.31
- 3.1.30
- 3.1.29
- 3.1.28
- 3.1.27
- 3.1.26
- 3.1.25
- 3.1.24
- 3.1.23
- 3.1.22
- 3.1.20
- 3.1.19
- 3.1.18
- 3.1.17
- 3.1.15
- 3.1.14
- 3.1.13
- 3.1.12
- 3.1.11
- 3.1.10
- 3.1.9
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.34
- 3.0.33
- 3.0.32
- 3.0.31
- 3.0.30
- 3.0.29
- 3.0.28
- 3.0.27
- 3.0.26
- 3.0.25
- 3.0.24
- 3.0.23
- 3.0.22
- 3.0.21
- 3.0.20
- 3.0.19
- 3.0.18
- 3.0.17
- 3.0.16
- 3.0.15
- 3.0.14
- 3.0.13
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.6
- 3.0.5
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.1
- 2.1.0
- 2.0.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.1
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-dev/v9.0
- dev-develop
This package is auto-updated.
Last update: 2022-06-17 10:31:46 UTC
README
Installation
Composer
To include the package in your project, Please run following command.
composer require webpress/dynamic-contact-form
Migration
Run the following commands to create table
php artisan migrate
Config
Run the following commands to publish configuration file:
php artisan vendor:publish --provider="VCComponent\Laravel\ConfigContact\Providers\ConfigContactServiceProvider"
Example: Contact page can have 3 positions appear contact form
In dynamic-contact-form.php
you can define the page and the location of the contact form as follows:
<?php return [ .... 'page' => [ 'contact' => [ 'label' => 'Contact', 'position' => [ 'position-1' => 'On the left', 'position-2' => 'On the right', 'position-3' => 'Main position', ], ], ], ];
Kernel
protected $middleware = [ ..... \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class ];
View/Composer & AppServiceProvider
Create ContactFormComposer.php
:
use VCComponent\Laravel\ConfigContact\Entites\ContactForm; ... class ContactFormComposer{ public function compose(View $view) { $contact_form = new ContactForm; $view->with('contact_form', $contact_form); } }
In AppServiceProvider.php
:
use App\Http\View\Composers\ContactFormComposer; ... public function boot() { View::composer('[The.page.has.a.contact.form]', ContactFormComposer::class); }
Front-end
In contact.blade.php
use the following codes to show contact form:
@if ($errors->any()) <div class="alert alert-danger"> <ul "> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif @if (session('success')) <div class="alert alert-success"> {{ session('success') }} </div> @endif @include('contact_form::show-contact-form', ['page' => 'contact', 'position ' => 'position-1' ])
Routes
The api endpoint should have these format:
Verb | URI | Action |
---|---|---|
Admin | ||
GET | /api/admin/contact-form/ | Index |
GET | /api/admin/contact-form/{id} | Show |
POST | /api/admin/contact-form | store |
PUT | /api/admin/contact-form/{id} | Update |
DELETE | /api/admin/contact-form/{id} | Destroy |
PUT | /api/admin/contact-form/{id}/change-status | Change status |
GET | /api/admin/contact-forms/list | List |
------ | ---------------------------------- | -------- |
GET | /api/admin/contact-form-input/{id} | show |
POST | /api/admin/contact-form-input | Store |
PUT | /api/admin/contact-form-input/{id} | Update |
DELETE | /api/admin/contact-form-input/{id} | Destroy |
------ | ---------------------------------- | -------- |
GET | /api/admin/contact-form-value | Index |
GET | /api/admin/contact-form-value/{id} | show |
PUT | /api/admin/contact-form-value/{id} | Update |
DELETE | /api/admin/contact-form-value/{id} | Destroy |
PUT | /api/admin/contact-form-value/{id}/status | Change status |
------ | ---------------------------------- | -------- |
GET | /api/admin/contact-form/{id}/contact-form-value | Get payload |
GET | /api/admin/contact-form/get-page-list | Get page list |
GET | /api/admin/get-position-list/{slug} | Get position list |
Front-end | ||
POST | /send-contact-infor | Store |