Allow micropub to post notes and articles
This commit is contained in:
parent
5eed665801
commit
ca6205d2a6
9 changed files with 102 additions and 49 deletions
30
app/Services/Service.php
Normal file
30
app/Services/Service.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
abstract class Service
|
||||
{
|
||||
abstract public function create(array $request, ?string $client = null): Model;
|
||||
|
||||
protected function getDataByKey(array $request, string $key): ?string
|
||||
{
|
||||
if (Arr::get($request, "properties.{$key}.0.html")) {
|
||||
return Arr::get($request, "properties.{$key}.0.html");
|
||||
}
|
||||
|
||||
if (is_string(Arr::get($request, "properties.{$key}.0"))) {
|
||||
return Arr::get($request, "properties.{$key}.0");
|
||||
}
|
||||
|
||||
if (is_string(Arr::get($request, "properties.{$key}"))) {
|
||||
return Arr::get($request, "properties.{$key}");
|
||||
}
|
||||
|
||||
return Arr::get($request, $key);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue