elephantpink/contact

为 Laravel 6 设计的简单联系包。

dev-master 2020-07-06 11:00 UTC

This package is not auto-updated.

Last update: 2024-09-24 06:49:47 UTC


README

安装包

 composer require elephantpink/contact 

数据库:迁移和种子文件

 php artisan vendor:publish --tag=epink-contact-migrations

之后,您将在主数据库/migrations 文件夹下找到迁移文件。

为了创建所需的表,运行

 php artisan migrate

如果您想在数据库中运行示例数据,运行

 php artisan db:seed --class=ContactSeeder

前端

为了使用这些组件,您需要安装以下node包

要这样做,执行

 npm install lang.js laravel-mix-svg-vue svg-vue vue vue-template-compiler vue-router vuex

您可以直接使用供应商文件夹中的组件,或者如果您需要对其进行自定义,只需将它们发布到资源文件夹即可

 php artisan vendor:publish --tag=epink-contact-assets 

这将创建两个独立的“contact”文件夹,分别位于 resources/js 和 resources/sass 下。

路由导入示例

import contactAdminRoutes from './contact/router'

let routes = [other routes]

routes = routes.concat(contactAdminRoutes [, other router files ])

const router = new VueRouter({ 
  routes: routes 
})

存储导入示例

import Vue from 'vue'
import Vuex from 'vuex'
import contactStore from './contact/store'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    contact: contactStore,
  },
  ...
})

翻译导入示例

import Lang from 'lang.js';
import contactTranslations from './contact/translations'

let lang = new Lang();
let fullTranslations = Object.assign({}, contactTranslations [, other translation files ])
lang.setMessages(fullTranslations)

图标

为了使用svg-vue图标,您应该在webpack.mix.js文件中添加laravel-mix-svg-vue修改,使其具有以下内容

const mix = require('laravel-mix');
require('laravel-mix-svg-vue');

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .svgVue()