-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.3.0: Migration to Laraberg 1.1.0, fixing embed and fullscreen bug. …
…Gutenberg now shows only on created model.
- Loading branch information
1 parent
3f90b3b
commit 6884056
Showing
27 changed files
with
197,348 additions
and
136,651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
]; | ||
} | ||
} | ||
|
Oops, something went wrong.