commit
5f8d6ca882
2 changed files with 37 additions and 1 deletions
36
app/Console/Commands/UpdateWebmentionsRelationship.php
Normal file
36
app/Console/Commands/UpdateWebmentionsRelationship.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateWebmentionsRelationship extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'webmentions:update-model-relationship';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update webmentions to relate to the correct note model class';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
DB::table('webmentions')
|
||||
->where('commentable_type', '=', 'App\Model\Note')
|
||||
->update(['commentable_type' => Note::class]);
|
||||
|
||||
$this->info('All webmentions updated to relate to the correct note model class');
|
||||
}
|
||||
}
|
|
@ -92,7 +92,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
$webmention->source = $this->source;
|
||||
$webmention->target = $this->note->longurl;
|
||||
$webmention->commentable_id = $this->note->id;
|
||||
$webmention->commentable_type = 'App\Model\Note';
|
||||
$webmention->commentable_type = Note::class;
|
||||
$webmention->type = $type;
|
||||
$webmention->mf2 = json_encode($microformats);
|
||||
$webmention->save();
|
||||
|
|
Loading…
Add table
Reference in a new issue