Massive simplification of code for displaying webmentions of notes, and the micropub client used to make a note
This commit is contained in:
parent
c96539f9c8
commit
8477aba87b
6 changed files with 173 additions and 117 deletions
42
app/Jobs/AddClientToDatabase.php
Normal file
42
app/Jobs/AddClientToDatabase.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\MicropubClient;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class AddClientToDatabase implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $client_id;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $client_id)
|
||||
{
|
||||
$this->client_id = $client_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (MicropubClient::where('client_url', $this->client_id)->count() == 0) {
|
||||
$client = MicropubClient::create([
|
||||
'client_url' => $this->client_id,
|
||||
'client_name' => $this->client_id, // default client name is the URL
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue