Upgrade to Laravel 9 (#252)
This commit is contained in:
parent
16a4d89d18
commit
78bd468d3d
28 changed files with 2235 additions and 3426 deletions
|
@ -138,8 +138,8 @@ class ContactsController extends Controller
|
|||
}
|
||||
$mf2 = \Mf2\parse((string) $response->getBody(), $contact->homepage);
|
||||
foreach ($mf2['items'] as $microformat) {
|
||||
if (Arr::get($microformat, 'type.0') == 'h-card') {
|
||||
$avatarURL = Arr::get($microformat, 'properties.photo.0');
|
||||
if (Arr::get($microformat, 'type.0') === 'h-card') {
|
||||
$avatarURL = Arr::get($microformat, 'properties.photo.0.value');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display search results.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function search(): View
|
||||
{
|
||||
$notes = Note::search(request()->input('terms'))->paginate(10);
|
||||
|
||||
return view('search', compact('notes'));
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
|
@ -19,5 +19,10 @@ class TrustProxies extends Middleware
|
|||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
|
|
|
@ -5,58 +5,19 @@ declare(strict_types=1);
|
|||
namespace App\Models;
|
||||
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use League\CommonMark\Block\Element\FencedCode;
|
||||
use League\CommonMark\Block\Element\IndentedCode;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use League\CommonMark\Environment;
|
||||
use League\CommonMark\Environment\Environment;
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode;
|
||||
use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode;
|
||||
use League\CommonMark\MarkdownConverter;
|
||||
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
|
||||
use Spatie\CommonMarkHighlighter\IndentedCodeRenderer;
|
||||
|
||||
/**
|
||||
* App\Models\Article.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $titleurl
|
||||
* @property string|null $url
|
||||
* @property string $title
|
||||
* @property string $main
|
||||
* @property int $published
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property-read string $html
|
||||
* @property-read string $human_time
|
||||
* @property-read string $link
|
||||
* @property-read string $pubdate
|
||||
* @property-read string $tooltip_time
|
||||
* @property-read string $w3c_time
|
||||
* @method static Builder|Article date($year = null, $month = null)
|
||||
* @method static Builder|Article findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static Builder|Article newModelQuery()
|
||||
* @method static Builder|Article newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Article onlyTrashed()
|
||||
* @method static Builder|Article query()
|
||||
* @method static bool|null restore()
|
||||
* @method static Builder|Article whereCreatedAt($value)
|
||||
* @method static Builder|Article whereDeletedAt($value)
|
||||
* @method static Builder|Article whereId($value)
|
||||
* @method static Builder|Article whereMain($value)
|
||||
* @method static Builder|Article wherePublished($value)
|
||||
* @method static Builder|Article whereTitle($value)
|
||||
* @method static Builder|Article whereTitleurl($value)
|
||||
* @method static Builder|Article whereUpdatedAt($value)
|
||||
* @method static Builder|Article whereUrl($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Article withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Article withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Article extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
@ -105,12 +66,13 @@ class Article extends Model
|
|||
*/
|
||||
public function getHtmlAttribute(): string
|
||||
{
|
||||
$environment = Environment::createCommonMarkEnvironment();
|
||||
$environment->addBlockRenderer(FencedCode::class, new FencedCodeRenderer());
|
||||
$environment->addBlockRenderer(IndentedCode::class, new IndentedCodeRenderer());
|
||||
$commonMarkConverter = new CommonMarkConverter([], $environment);
|
||||
$environment = new Environment();
|
||||
$environment->addExtension(new CommonMarkCoreExtension());
|
||||
$environment->addRenderer(FencedCode::class, new FencedCodeRenderer());
|
||||
$environment->addRenderer(IndentedCode::class, new IndentedCodeRenderer());
|
||||
$markdownConverter = new MarkdownConverter($environment);
|
||||
|
||||
return $commonMarkConverter->convertToHtml($this->main);
|
||||
return $markdownConverter->convert($this->main)->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
|
|
@ -4,36 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\Contact.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $nick
|
||||
* @property string $name
|
||||
* @property string|null $homepage
|
||||
* @property string|null $twitter
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $facebook
|
||||
* @method static Builder|Contact newModelQuery()
|
||||
* @method static Builder|Contact newQuery()
|
||||
* @method static Builder|Contact query()
|
||||
* @method static Builder|Contact whereCreatedAt($value)
|
||||
* @method static Builder|Contact whereFacebook($value)
|
||||
* @method static Builder|Contact whereHomepage($value)
|
||||
* @method static Builder|Contact whereId($value)
|
||||
* @method static Builder|Contact whereName($value)
|
||||
* @method static Builder|Contact whereNick($value)
|
||||
* @method static Builder|Contact whereTwitter($value)
|
||||
* @method static Builder|Contact whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Contact extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||
namespace App\Models;
|
||||
|
||||
use App\Traits\FilterHtml;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
@ -13,28 +12,6 @@ use Illuminate\Support\Arr;
|
|||
use Illuminate\Support\Carbon;
|
||||
use Mf2;
|
||||
|
||||
/**
|
||||
* App\Models\Like.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $url
|
||||
* @property string|null $author_name
|
||||
* @property string|null $author_url
|
||||
* @property string|null $content
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @method static Builder|Like newModelQuery()
|
||||
* @method static Builder|Like newQuery()
|
||||
* @method static Builder|Like query()
|
||||
* @method static Builder|Like whereAuthorName($value)
|
||||
* @method static Builder|Like whereAuthorUrl($value)
|
||||
* @method static Builder|Like whereContent($value)
|
||||
* @method static Builder|Like whereCreatedAt($value)
|
||||
* @method static Builder|Like whereId($value)
|
||||
* @method static Builder|Like whereUpdatedAt($value)
|
||||
* @method static Builder|Like whereUrl($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Like extends Model
|
||||
{
|
||||
use FilterHtml;
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
@ -12,34 +11,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Models\Media.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $token
|
||||
* @property string $path
|
||||
* @property string $type
|
||||
* @property int|null $note_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $image_widths
|
||||
* @property-read string $mediumurl
|
||||
* @property-read string $smallurl
|
||||
* @property-read string $url
|
||||
* @property-read Note|null $note
|
||||
* @method static Builder|Media newModelQuery()
|
||||
* @method static Builder|Media newQuery()
|
||||
* @method static Builder|Media query()
|
||||
* @method static Builder|Media whereCreatedAt($value)
|
||||
* @method static Builder|Media whereId($value)
|
||||
* @method static Builder|Media whereImageWidths($value)
|
||||
* @method static Builder|Media whereNoteId($value)
|
||||
* @method static Builder|Media wherePath($value)
|
||||
* @method static Builder|Media whereToken($value)
|
||||
* @method static Builder|Media whereType($value)
|
||||
* @method static Builder|Media whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Media extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -12,26 +11,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\MicropubClient.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $client_url
|
||||
* @property string $client_name
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|\App\Models\Note[] $notes
|
||||
* @property-read int|null $notes_count
|
||||
* @method static Builder|MicropubClient newModelQuery()
|
||||
* @method static Builder|MicropubClient newQuery()
|
||||
* @method static Builder|MicropubClient query()
|
||||
* @method static Builder|MicropubClient whereClientName($value)
|
||||
* @method static Builder|MicropubClient whereClientUrl($value)
|
||||
* @method static Builder|MicropubClient whereCreatedAt($value)
|
||||
* @method static Builder|MicropubClient whereId($value)
|
||||
* @method static Builder|MicropubClient whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class MicropubClient extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -10,92 +10,22 @@ use Codebird\Codebird;
|
|||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\Relations\{BelongsTo, BelongsToMany, HasMany, MorphMany};
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model, SoftDeletes};
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Eloquent\{Builder, Factories\HasFactory, Model, SoftDeletes};
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use Laravel\Scout\Searchable;
|
||||
use League\CommonMark\Block\Element\{FencedCode, IndentedCode};
|
||||
use League\CommonMark\Environment\Environment;
|
||||
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
||||
use League\CommonMark\{CommonMarkConverter, Environment};
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode;
|
||||
use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode;
|
||||
use League\CommonMark\MarkdownConverter;
|
||||
use Normalizer;
|
||||
use Spatie\CommonMarkHighlighter\{FencedCodeRenderer, IndentedCodeRenderer};
|
||||
use App\Models\Tag;
|
||||
use App\Models\MicropubClient;
|
||||
use App\Models\WebMention;
|
||||
use App\Models\Place;
|
||||
use App\Models\Media;
|
||||
|
||||
/**
|
||||
* App\Models\Note.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $note
|
||||
* @property string|null $in_reply_to
|
||||
* @property string $shorturl
|
||||
* @property string|null $location
|
||||
* @property int|null $photo
|
||||
* @property string|null $tweet_id
|
||||
* @property string|null $client_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property int|null $place_id
|
||||
* @property string|null $facebook_url
|
||||
* @property string|null $searchable
|
||||
* @property string|null $swarm_url
|
||||
* @property string|null $instagram_url
|
||||
* @property-read MicropubClient|null $client
|
||||
* @property-read string|null $address
|
||||
* @property-read string $content
|
||||
* @property-read string $humandiff
|
||||
* @property-read string $iso8601
|
||||
* @property-read float|null $latitude
|
||||
* @property-read float|null $longitude
|
||||
* @property-read string $longurl
|
||||
* @property-read string $nb60id
|
||||
* @property-read string $pubdate
|
||||
* @property-read object|null $twitter
|
||||
* @property-read string $twitter_content
|
||||
* @property-read Collection|Media[] $media
|
||||
* @property-read int|null $media_count
|
||||
* @property-read Place|null $place
|
||||
* @property-read Collection|Tag[] $tags
|
||||
* @property-read int|null $tags_count
|
||||
* @property-read Collection|WebMention[] $webmentions
|
||||
* @property-read int|null $webmentions_count
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static Builder|Note nb60($nb60id)
|
||||
* @method static Builder|Note newModelQuery()
|
||||
* @method static Builder|Note newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Note onlyTrashed()
|
||||
* @method static Builder|Note query()
|
||||
* @method static bool|null restore()
|
||||
* @method static Builder|Note whereClientId($value)
|
||||
* @method static Builder|Note whereCreatedAt($value)
|
||||
* @method static Builder|Note whereDeletedAt($value)
|
||||
* @method static Builder|Note whereFacebookUrl($value)
|
||||
* @method static Builder|Note whereId($value)
|
||||
* @method static Builder|Note whereInReplyTo($value)
|
||||
* @method static Builder|Note whereInstagramUrl($value)
|
||||
* @method static Builder|Note whereLocation($value)
|
||||
* @method static Builder|Note whereNote($value)
|
||||
* @method static Builder|Note wherePhoto($value)
|
||||
* @method static Builder|Note wherePlaceId($value)
|
||||
* @method static Builder|Note whereSearchable($value)
|
||||
* @method static Builder|Note whereShorturl($value)
|
||||
* @method static Builder|Note whereSwarmUrl($value)
|
||||
* @method static Builder|Note whereTweetId($value)
|
||||
* @method static Builder|Note whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Note withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Note withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Note extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Searchable;
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
|
@ -597,13 +527,14 @@ class Note extends Model
|
|||
*/
|
||||
private function convertMarkdown(string $note): string
|
||||
{
|
||||
$environment = Environment::createCommonMarkEnvironment();
|
||||
$environment = new Environment();
|
||||
$environment->addExtension(new CommonMarkCoreExtension());
|
||||
$environment->addExtension(new AutolinkExtension());
|
||||
$environment->addBlockRenderer(FencedCode::class, new FencedCodeRenderer());
|
||||
$environment->addBlockRenderer(IndentedCode::class, new IndentedCodeRenderer());
|
||||
$converter = new CommonMarkConverter([], $environment);
|
||||
$environment->addRenderer(FencedCode::class, new FencedCodeRenderer());
|
||||
$environment->addRenderer(IndentedCode::class, new IndentedCodeRenderer());
|
||||
$markdownConverter = new MarkdownConverter($environment);
|
||||
|
||||
return $converter->convertToHtml($note);
|
||||
return $markdownConverter->convert($note)->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,50 +5,11 @@ declare(strict_types=1);
|
|||
namespace App\Models;
|
||||
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model};
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Models\Place.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $slug
|
||||
* @property string|null $description
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $icon
|
||||
* @property string|null $foursquare
|
||||
* @property mixed|null $external_urls
|
||||
* @property float|null $latitude
|
||||
* @property float|null $longitude
|
||||
* @property-read string $longurl
|
||||
* @property-read string $shorturl
|
||||
* @property-read string $uri
|
||||
* @property-read Collection|\App\Models\Note[] $notes
|
||||
* @property-read int|null $notes_count
|
||||
* @method static Builder|Place findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static Builder|Place near($location, $distance = 1000)
|
||||
* @method static Builder|Place newModelQuery()
|
||||
* @method static Builder|Place newQuery()
|
||||
* @method static Builder|Place query()
|
||||
* @method static Builder|Place whereCreatedAt($value)
|
||||
* @method static Builder|Place whereDescription($value)
|
||||
* @method static Builder|Place whereExternalURL($url)
|
||||
* @method static Builder|Place whereExternalUrls($value)
|
||||
* @method static Builder|Place whereFoursquare($value)
|
||||
* @method static Builder|Place whereIcon($value)
|
||||
* @method static Builder|Place whereId($value)
|
||||
* @method static Builder|Place whereLatitude($value)
|
||||
* @method static Builder|Place whereLongitude($value)
|
||||
* @method static Builder|Place whereName($value)
|
||||
* @method static Builder|Place whereSlug($value)
|
||||
* @method static Builder|Place whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Place extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -13,26 +12,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Models\Tag.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $tag
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Bookmark[] $bookmarks
|
||||
* @property-read int|null $bookmarks_count
|
||||
* @property-read Collection|Note[] $notes
|
||||
* @property-read int|null $notes_count
|
||||
* @method static Builder|Tag newModelQuery()
|
||||
* @method static Builder|Tag newQuery()
|
||||
* @method static Builder|Tag query()
|
||||
* @method static Builder|Tag whereCreatedAt($value)
|
||||
* @method static Builder|Tag whereId($value)
|
||||
* @method static Builder|Tag whereTag($value)
|
||||
* @method static Builder|Tag whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Tag extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
@ -13,28 +12,6 @@ use Illuminate\Notifications\DatabaseNotificationCollection;
|
|||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\User.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $password
|
||||
* @property string|null $remember_token
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
|
||||
* @property-read int|null $notifications_count
|
||||
* @method static Builder|User newModelQuery()
|
||||
* @method static Builder|User newQuery()
|
||||
* @method static Builder|User query()
|
||||
* @method static Builder|User whereCreatedAt($value)
|
||||
* @method static Builder|User whereId($value)
|
||||
* @method static Builder|User whereName($value)
|
||||
* @method static Builder|User wherePassword($value)
|
||||
* @method static Builder|User whereRememberToken($value)
|
||||
* @method static Builder|User whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
|
|
|
@ -6,7 +6,6 @@ namespace App\Models;
|
|||
|
||||
use App\Traits\FilterHtml;
|
||||
use Codebird\Codebird;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
@ -17,42 +16,6 @@ use Illuminate\Support\Facades\Cache;
|
|||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
|
||||
/**
|
||||
* App\Models\WebMention.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $source
|
||||
* @property string $target
|
||||
* @property int|null $commentable_id
|
||||
* @property string|null $commentable_type
|
||||
* @property string|null $type
|
||||
* @property string|null $content
|
||||
* @property int $verified
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $deleted_at
|
||||
* @property mixed|null $mf2
|
||||
* @property-read WebMention|null $commentable
|
||||
* @property-read array $author
|
||||
* @property-read string|null $published
|
||||
* @property-read string|null $reply
|
||||
* @method static Builder|WebMention newModelQuery()
|
||||
* @method static Builder|WebMention newQuery()
|
||||
* @method static Builder|WebMention query()
|
||||
* @method static Builder|WebMention whereCommentableId($value)
|
||||
* @method static Builder|WebMention whereCommentableType($value)
|
||||
* @method static Builder|WebMention whereContent($value)
|
||||
* @method static Builder|WebMention whereCreatedAt($value)
|
||||
* @method static Builder|WebMention whereDeletedAt($value)
|
||||
* @method static Builder|WebMention whereId($value)
|
||||
* @method static Builder|WebMention whereMf2($value)
|
||||
* @method static Builder|WebMention whereSource($value)
|
||||
* @method static Builder|WebMention whereTarget($value)
|
||||
* @method static Builder|WebMention whereType($value)
|
||||
* @method static Builder|WebMention whereUpdatedAt($value)
|
||||
* @method static Builder|WebMention whereVerified($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class WebMention extends Model
|
||||
{
|
||||
use FilterHtml;
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Telescope\IncomingEntry;
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||
|
||||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
Telescope::night();
|
||||
|
||||
$this->hideSensitiveRequestDetails();
|
||||
|
||||
Telescope::filter(function (IncomingEntry $entry) {
|
||||
if ($this->app->isLocal()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $entry->isReportableException() ||
|
||||
$entry->isFailedJob() ||
|
||||
$entry->isScheduledTask() ||
|
||||
$entry->hasMonitoredTag();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent sensitive request details from being logged by Telescope.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function hideSensitiveRequestDetails()
|
||||
{
|
||||
if ($this->app->isLocal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telescope::hideRequestParameters(['_token']);
|
||||
|
||||
Telescope::hideRequestHeaders([
|
||||
'cookie',
|
||||
'x-csrf-token',
|
||||
'x-xsrf-token',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Telescope gate.
|
||||
*
|
||||
* This gate determines who can access Telescope in non-local environments.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function gate()
|
||||
{
|
||||
Gate::define('viewTelescope', function ($user) {
|
||||
return in_array($user->name, [
|
||||
'jonny',
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue