李帅

1.又重构一言表,新增一个字段

......@@ -48,7 +48,7 @@ class OnePoemController extends AdminController
$grid->column('','诗句组')
->display('展开')
->expand(function (){
$th = ['id','一言Id','正文','注释','拼音','英文','创建时间','修改时间'];
$th = ['id','一言Id','正文','注释','拼音','英文','出处','创建时间','修改时间'];
return Table::make($th, $this->verses->toArray())->withBorder();
});
$grid->column('created_at');
......@@ -76,6 +76,7 @@ class OnePoemController extends AdminController
$show->field('annotate');
$show->field('spelling');
$show->field('en');
$show->field('source');
$show->field('poetry_id');
$show->field('created_at');
$show->field('updated_at');
......@@ -112,6 +113,7 @@ class OnePoemController extends AdminController
$form->textarea('annotate');
$form->textarea('spelling');
$form->textarea('en');
$form->textarea('source');
})->useTable();
$form->display('created_at');
......
......@@ -226,7 +226,23 @@ class AdminMakeImmerse implements ShouldQueue
case 'one_poem_with_annotate':
foreach ($this->adminMakeVideo->poem2->verses as $item) {
if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
if ($item->annotate != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
}
break;
case 'one_poem_with_annotate_and_source':
foreach ($this->adminMakeVideo->poem2->verses as $item) {
if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
if ($item->source != '') $contents[] = $this->autoEnter($item->source, $font_size, $this->output_width);
}
break;
case 'one_poem_with_all':
foreach ($this->adminMakeVideo->poem2->verses as $item) {
if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
if ($item->spelling != '') $contents[] = $this->autoEnter($item->spelling, $font_size, $this->output_width);
if ($item->en != '') $contents[] = $this->autoEnter($item->en, $font_size, $this->output_width);
if ($item->source != '') $contents[] = $this->autoEnter($item->source, $font_size, $this->output_width);
}
break;
case 'weather':
......@@ -268,6 +284,8 @@ class AdminMakeImmerse implements ShouldQueue
$contents = []; //
switch ($component->name){
case 'one_poem_with_annotate':
case 'one_poem_with_annotate_and_source':
case 'one_poem_with_all':
case 'one_poem':
$stanzas = '';
foreach ($this->adminMakeVideo->poem2->verses as $item) {
......
......@@ -9,7 +9,7 @@ class OneSentence extends Model
{
use HasFactory;
protected $fillable = ['content', 'annotate', 'spelling', 'en'];
protected $fillable = ['content', 'annotate', 'spelling', 'en', 'source'];
public function poem2()
{
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterOneSentencesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('one_sentences', function (Blueprint $table) {
$table->string('source')->after('en')->default('')->comment('出处');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropColumns('one_sentences', ['source']);
}
}
......@@ -11,6 +11,7 @@ return [
'annotate' => '注解',
'spelling' => '拼音',
'en' => '英文解释',
'source' => '出处',
'poetry_id' => '诗词id',
'state' => '状态',
......