李帅

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

...@@ -48,7 +48,7 @@ class OnePoemController extends AdminController ...@@ -48,7 +48,7 @@ class OnePoemController extends AdminController
48 $grid->column('','诗句组') 48 $grid->column('','诗句组')
49 ->display('展开') 49 ->display('展开')
50 ->expand(function (){ 50 ->expand(function (){
51 - $th = ['id','一言Id','正文','注释','拼音','英文','创建时间','修改时间']; 51 + $th = ['id','一言Id','正文','注释','拼音','英文','出处','创建时间','修改时间'];
52 return Table::make($th, $this->verses->toArray())->withBorder(); 52 return Table::make($th, $this->verses->toArray())->withBorder();
53 }); 53 });
54 $grid->column('created_at'); 54 $grid->column('created_at');
...@@ -76,6 +76,7 @@ class OnePoemController extends AdminController ...@@ -76,6 +76,7 @@ class OnePoemController extends AdminController
76 $show->field('annotate'); 76 $show->field('annotate');
77 $show->field('spelling'); 77 $show->field('spelling');
78 $show->field('en'); 78 $show->field('en');
79 + $show->field('source');
79 $show->field('poetry_id'); 80 $show->field('poetry_id');
80 $show->field('created_at'); 81 $show->field('created_at');
81 $show->field('updated_at'); 82 $show->field('updated_at');
...@@ -112,6 +113,7 @@ class OnePoemController extends AdminController ...@@ -112,6 +113,7 @@ class OnePoemController extends AdminController
112 $form->textarea('annotate'); 113 $form->textarea('annotate');
113 $form->textarea('spelling'); 114 $form->textarea('spelling');
114 $form->textarea('en'); 115 $form->textarea('en');
116 + $form->textarea('source');
115 })->useTable(); 117 })->useTable();
116 118
117 $form->display('created_at'); 119 $form->display('created_at');
......
...@@ -226,7 +226,23 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -226,7 +226,23 @@ class AdminMakeImmerse implements ShouldQueue
226 case 'one_poem_with_annotate': 226 case 'one_poem_with_annotate':
227 foreach ($this->adminMakeVideo->poem2->verses as $item) { 227 foreach ($this->adminMakeVideo->poem2->verses as $item) {
228 if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width); 228 if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
229 - if ($item->annotate != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width); 229 + if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
230 + }
231 + break;
232 + case 'one_poem_with_annotate_and_source':
233 + foreach ($this->adminMakeVideo->poem2->verses as $item) {
234 + if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
235 + if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
236 + if ($item->source != '') $contents[] = $this->autoEnter($item->source, $font_size, $this->output_width);
237 + }
238 + break;
239 + case 'one_poem_with_all':
240 + foreach ($this->adminMakeVideo->poem2->verses as $item) {
241 + if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width);
242 + if ($item->annotate != '') $contents[] = $this->autoEnter($item->annotate, $font_size, $this->output_width);
243 + if ($item->spelling != '') $contents[] = $this->autoEnter($item->spelling, $font_size, $this->output_width);
244 + if ($item->en != '') $contents[] = $this->autoEnter($item->en, $font_size, $this->output_width);
245 + if ($item->source != '') $contents[] = $this->autoEnter($item->source, $font_size, $this->output_width);
230 } 246 }
231 break; 247 break;
232 case 'weather': 248 case 'weather':
...@@ -268,6 +284,8 @@ class AdminMakeImmerse implements ShouldQueue ...@@ -268,6 +284,8 @@ class AdminMakeImmerse implements ShouldQueue
268 $contents = []; // 284 $contents = []; //
269 switch ($component->name){ 285 switch ($component->name){
270 case 'one_poem_with_annotate': 286 case 'one_poem_with_annotate':
287 + case 'one_poem_with_annotate_and_source':
288 + case 'one_poem_with_all':
271 case 'one_poem': 289 case 'one_poem':
272 $stanzas = ''; 290 $stanzas = '';
273 foreach ($this->adminMakeVideo->poem2->verses as $item) { 291 foreach ($this->adminMakeVideo->poem2->verses as $item) {
......
...@@ -9,7 +9,7 @@ class OneSentence extends Model ...@@ -9,7 +9,7 @@ class OneSentence extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 - protected $fillable = ['content', 'annotate', 'spelling', 'en']; 12 + protected $fillable = ['content', 'annotate', 'spelling', 'en', 'source'];
13 13
14 public function poem2() 14 public function poem2()
15 { 15 {
......
1 +<?php
2 +
3 +use Illuminate\Database\Migrations\Migration;
4 +use Illuminate\Database\Schema\Blueprint;
5 +use Illuminate\Support\Facades\Schema;
6 +
7 +class AlterOneSentencesTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::table('one_sentences', function (Blueprint $table) {
17 + $table->string('source')->after('en')->default('')->comment('出处');
18 + });
19 + }
20 +
21 + /**
22 + * Reverse the migrations.
23 + *
24 + * @return void
25 + */
26 + public function down()
27 + {
28 + Schema::dropColumns('one_sentences', ['source']);
29 + }
30 +}
...@@ -11,6 +11,7 @@ return [ ...@@ -11,6 +11,7 @@ return [
11 'annotate' => '注解', 11 'annotate' => '注解',
12 'spelling' => '拼音', 12 'spelling' => '拼音',
13 'en' => '英文解释', 13 'en' => '英文解释',
14 + 'source' => '出处',
14 'poetry_id' => '诗词id', 15 'poetry_id' => '诗词id',
15 'state' => '状态', 16 'state' => '状态',
16 17
......