Skip to content

Commit

Permalink
1.3.0: Migration to Laraberg 1.1.0, fixing embed and fullscreen bug. …
Browse files Browse the repository at this point in the history
…Gutenberg now shows only on created model.
  • Loading branch information
FlusherDock1 committed Mar 28, 2020
1 parent 3f90b3b commit 6884056
Show file tree
Hide file tree
Showing 27 changed files with 197,348 additions and 136,651 deletions.
21 changes: 3 additions & 18 deletions classes/OEmbedController.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
<?php namespace ReaZzon\Gutenberg\Classes;

use Illuminate\Http\Request;
use Embed\Embed;
use ReaZzon\Gutenberg\Helpers\EmbedHelper;

class OEmbedController extends ApplicationController
{
public function __invoke(Request $request)
{
$embed = Embed::create($request->url);
$data = $this->serializeEmbed($embed);
$embed = EmbedHelper::create($request->url);
$data = EmbedHelper::serialize($embed);
if ($data['html'] == null) {
return $this->notFound();
}
return $this->ok($data);
}

private function serializeEmbed($embed)
{
return [
'url' => $embed->url,
'author_name' => $embed->authorName,
'author_url' => $embed->authorUrl,
'html' => $embed->code,
'width' => $embed->width,
'height' => $embed->height,
'type' => $embed->type,
'provider_name' => $embed->providerName,
'provider_url' => $embed->providerUrl
];
}
}

Loading

0 comments on commit 6884056

Please sign in to comment.