Skip to content

Commit

Permalink
package files
Browse files Browse the repository at this point in the history
  • Loading branch information
BahaaAlhagar committed Jul 31, 2018
1 parent 508bac4 commit b329d75
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 116 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# :package_name
# :Youtube Uploader
57 changes: 57 additions & 0 deletions config/youtubeUploader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

return [

/**
* Client ID.
*/
'client_id' => env('GOOGLE_CLIENT_ID', null),

/**
* Client Secret.
*/
'client_secret' => env('GOOGLE_CLIENT_SECRET', null),

/**
* Scopes.
*/
'scopes' => [
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtube.readonly'
],

/**
* Route URI's
*/
'routes' => [

/**
* Determine if the Routes should be disabled.
* Note: We recommend this to be set to "false" immediately after authentication.
*/
'enabled' => false,

/**
* The prefix for the below URI's
*/
'prefix' => 'youtube',

/**
* Redirect URI
*/
'redirect_uri' => 'callback',

/**
* The autentication URI
*/
'authentication_uri' => 'auth',

/**
* The redirect back URI
*/
'redirect_back_uri' => '/',

]

];
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateYoutubeAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('youtube_access_tokens', function(Blueprint $table)
{
$table->increments('id');
$table->text('access_token');
$table->timestamp('created_at');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('youtube_access_tokens');
}
}
111 changes: 0 additions & 111 deletions prefill.php

This file was deleted.

32 changes: 32 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* Route URI's
*/
Route::group(['prefix' => config('youtube.routes.prefix')], function() {

/**
* Authentication
*/
Route::get(config('youtube.routes.authentication_uri'), function()
{
return redirect()->to(YoutubeUploader::createAuthUrl());
});

/**
* Redirect
*/
Route::get(config('youtube.routes.redirect_uri'), function(Illuminate\Http\Request $request)
{
if(!$request->has('code')) {
throw new Exception('$_GET[\'code\'] is not set. Please re-authenticate.');
}

$token = YoutubeUploader::authenticate($request->get('code'));

YoutubeUploader::saveAccessTokenToDB($token);

return redirect(config('youtube.routes.redirect_back_uri', '/'));
});

});
2 changes: 1 addition & 1 deletion src/Facades/YoutubeUploader.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace BahaaAlhagar\Youtube\Facades;
namespace BahaaAlhagar\YoutubeUploader\Facades;

use Illuminate\Support\Facades\Facade;

Expand Down
Loading

0 comments on commit b329d75

Please sign in to comment.