function postCreate(Request $request) { $data = $request->all(); //Registra una nueva cuenta de videocloud $account = new VideoCloudAccount(); $account->email = $data["email"]; $account->token = $data["token"]; $account->player = $data["player"]; $date = new DateUtil(DateUtil::getCurrentTime()); $account->date = $date->getCurrentTime(); $account->end = $date->addMonths(1); $account->save(); return redirect()->back()->with(UI::message(UI::MESSAGE_TYPE_SUCCESS, "Cuenta creada exitosamente")); }
function __construct($id_video) { $this->id_video = intval(trim($id_video)); $videocloud = VideoCloudAccount::find(Chapter::where(Chapter::ATTR_VIDEO, $id_video)->get()[0]->videocloud_id); $this->token = $videocloud->token; $this->player = $videocloud->player; }
/** Obtiene el email de la cuenta dado por su id * * @param type $id * @return type */ static function getAccountEmailById($id) { return VideoCloudAccount::where("id", $id)->orderBy("id", "DESC")->take(1)->get()[0]->email; }
function ajaxChapterCreator(Request $request) { if (!$request->ajax()) { return; } $data = $request->all(); $chapter = isset($data[Chapter::ATTR_ID]) ? Chapter::findOrNew($data[Chapter::ATTR_ID]) : new Chapter(); $chapter->production_id = $data[Chapter::ATTR_PRODUCTION_ID]; $chapter->name = $data[Chapter::ATTR_NAME]; $chapter->video = str_replace(array("\n", "\t", "\r", " "), "", $data[Chapter::ATTR_VIDEO]); $chapter->videocloud_id = VideoCloudAccount::getCurrentAccountId(); $chapter->quality = $data[Chapter::ATTR_QUALITY]; $chapter->languages = $data[Chapter::ATTR_LANGUAGES]; $chapter->subtitles = isset($data[Chapter::ATTR_SUBTITLES]) ? $data[Chapter::ATTR_SUBTITLES] : null; $chapter->type = $data[Chapter::ATTR_TYPE]; $chapter->state = $data[Chapter::ATTR_STATE]; $chapter->save(); return json_encode(array(Chapter::ATTR_ID => $chapter->id, Chapter::ATTR_NAME => $chapter->name, Chapter::ATTR_VIDEO => htmlentities($chapter->video), Chapter::ATTR_QUALITY => $chapter->quality, Chapter::ATTR_LANGUAGES => Util::formatResultArray($data[Chapter::ATTR_LANGUAGES], ",", "\"", "\""), Chapter::ATTR_SUBTITLES => Util::formatResultArray($chapter->subtitles, ",", "\"", "\""), Chapter::ATTR_STATE => $chapter->state)); }
<?php use App\System\Models\Chapter; use App\System\Library\Complements\Util; use App\System\Models\VideoCloudAccount; $langs = App\System\Library\Enum\Language::getAll(); $qualities = Chapter::getQualities(); $subs = Chapter::getSubtitles(); $chapters = $production->chapters; $isVideoMain = $production->haveVideoMain(); if ($isVideoMain) { $chapter = $chapters[0]; } $videocloud = !isset($chapter) ? VideoCloudAccount::getCurrentAccountEmail() : VideoCloudAccount::getAccountEmailById($chapter->videocloud_id); ?> @extends("manager/ui/templates/main") @section("title") {{trans("gen.info.edit")}}: {{$production->title}}@stop @section("content") <div class="col-md-12"> <div class="col-md-8"> @include("ui/msg/index",array("message_id"=>2)) </div> <div class="col-md-4"> <nav class="navbar navbar-default"> <div class="navbar-header"> <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-save"></span> {{trans("gen.info.as.save")}}:</a>