这是我的迁移代码.....或您可以说的架构
// create the svg
let svgSquare = document.createElementNS('http://http://www.w3.org/2000/svg', 'svg');
const clickClass = clickAnimationName.length ? `shape-${shapeLayerNum}-click-${clickAnimationName}` : '';
const mouseEnterClass = mouseEnterAnimationName.length ? `shape-${shapeLayerNum}-mouse-enter-${mouseEnterAnimationName}` : '';
const mouseLeaveClass = mouseLeaveAnimationName.length ? `shape-${shapeLayerNum}-mouse-leave-${mouseLeaveAnimationName}` : '';
const svgSquareClasses = `${clickClass} ${mouseEnterClass} ${mouseLeaveClass}`;
// add svg classes
// svgSquare.setAttribute('class', svgSquareClasses);
// set svg attributes
svgSquare.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
svgSquare.setAttribute('viewBox', `0 0 ${shapeScale/2} ${shapeScale/2}`);
svgSquare.setAttribute('fill', shapeConfig[`shape-${shapeLayerNum}-background`]);
svgSquare.setAttribute('stroke', 'black');
svgSquare.setAttribute('stroke-width', `${shapeScale/100}px`);
// sizing/centering
svgSquare.setAttribute('z-index', shapeConfig[`shape-${shapeLayerNum}-zIndex`]);
svgSquare.setAttribute('width', `${(shapeScale) + (shapeSpacing*2)}px`);
svgSquare.setAttribute('height', `${(shapeScale) + (shapeSpacing*2)}px`);
svgSquare.setAttribute('style', `margin-left: ${shapeMarginLeft}px; margin-top: ${shapeMarginTop}px;`);
// create the square rect
let polySquare = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
polySquare.setAttribute('width', `${(shapeWidth/2 - (shapeSpacing*2))}`);
polySquare.setAttribute('height', `${(shapeHeight/2) - (shapeSpacing*2)}`);
polySquare.setAttribute('x', `${shapeSpacing/2}`);
polySquare.setAttribute('y', `${shapeSpacing/2}`);
// rect polygon to svg
svgSquare.appendChild(polySquare);
当我在laravel上运行时出现错误:
答案 0 :(得分:1)
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('to');
$table->string('from');
$table->string('mobile')->nullable();
$table->rememberToken();
$table->timestamps();
});
}
public function down()
{
Schema::drop('users');
}
}
尝试使用此代码, 还要检查env文件和database.php中相关数据库的设置