This commit is contained in:
Benjamin Takats
2023-01-15 21:07:02 +01:00
parent 02493751ce
commit acfb90d3c8
10 changed files with 509 additions and 272 deletions

View File

@@ -136,7 +136,7 @@ class BookCaseTable extends DataTableComponent
$this->validate([ $this->validate([
'orangepill.amount' => 'required|numeric', 'orangepill.amount' => 'required|numeric',
'orangepill.date' => 'required|date', 'orangepill.date' => 'required|date',
'photo' => 'image|max:4096', // 4MB Max 'photo' => 'image|max:8192', // 8MB Max
]); ]);
$orangePill = OrangePill::create([ $orangePill = OrangePill::create([
'user_id' => auth()->id(), 'user_id' => auth()->id(),

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TwitterAccount extends Model
{
protected $guarded = [];
protected $casts = [
'data' => 'array',
];
}

View File

@@ -22,6 +22,7 @@
"laravel/jetstream": "^2.12", "laravel/jetstream": "^2.12",
"laravel/nova": "~4.0", "laravel/nova": "~4.0",
"laravel/sanctum": "^3.0", "laravel/sanctum": "^3.0",
"laravel/socialite": "^5.5",
"laravel/tinker": "^2.7", "laravel/tinker": "^2.7",
"livewire/livewire": "^2.5", "livewire/livewire": "^2.5",
"nova/start": "*", "nova/start": "*",

681
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -31,4 +31,12 @@ return [
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
], ],
'twitter' => [
'oauth' => 2,
'client_id' => env('TWITTER_CLIENT_ID'),
'client_secret' => env('TWITTER_CLIENT_SECRET'),
'redirect' => env('TWITTER_REDIRECT_URI'),
],
]; ];

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('twitter_accounts', function (Blueprint $table) {
$table->id();
$table->string('twitter_id');
$table->string('nickname');
$table->string('token');
$table->unsignedInteger('expires_in');
$table->json('data');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('twitter_accounts');
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{ {
"/app.js": "/app.js?id=8d0031f02505a357ea9665ac8501757d", "/app.js": "/app.js?id=ff630f0ed0a9f9a312a5fdc986bcfbc9",
"/manifest.js": "/manifest.js?id=d75058ce2144a4049857d3ff9e02de1e", "/manifest.js": "/manifest.js?id=d75058ce2144a4049857d3ff9e02de1e",
"/app.css": "/app.css?id=72ecd473fa8870767c692de160ca79ed", "/app.css": "/app.css?id=72ecd473fa8870767c692de160ca79ed",
"/vendor.js": "/vendor.js?id=de86bde8857e857b607852d11627d8e4", "/vendor.js": "/vendor.js?id=de86bde8857e857b607852d11627d8e4",

View File

@@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Laravel\Socialite\Facades\Socialite;
Route::get('/', \App\Http\Livewire\Frontend\Welcome::class) Route::get('/', \App\Http\Livewire\Frontend\Welcome::class)
->name('welcome'); ->name('welcome');
@@ -9,6 +10,33 @@ Route::get('/auth/ln', \App\Http\Livewire\Auth\LNUrlAuth::class)
->name('auth.ln') ->name('auth.ln')
->middleware('guest'); ->middleware('guest');
Route::get('/auth/twitter', function () {
return Socialite::driver('twitter')
->scopes([
'tweet.write',
])
->redirect();
})
->name('auth.twitter.redirect');
Route::get('/auth/twitter/callback', function () {
$twitterUser = Socialite::driver('twitter')
->user();
$twitterAccount = \App\Models\TwitterAccount::updateOrCreate([
'twitter_id' => $twitterUser->id,
], [
'twitter_id' => $twitterUser->id,
'nickname' => $twitterUser->nickname,
'token' => $twitterUser->token,
'expires_in' => $twitterUser->expiresIn,
'data' => [],
]);
echo 'Twitter account updated. We can now tweet on: '.$twitterUser->name;
die;
})
->name('auth.twitter');
/* /*
* School * School
* */ * */