Skip to content

Commit

Permalink
feat: Laravel Prompts, Breeze, Filament 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher committed Oct 6, 2023
1 parent c7e9064 commit bb100b8
Show file tree
Hide file tree
Showing 253 changed files with 9,116 additions and 1,319 deletions.
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Summary <!-- tl;dr one line summary of this PR -->

[//]: # (copilot:summary)
This pull request...

## Explanation <!-- A more in depth explanation of the approach, reasoning, questions etc... -->

[//]: # (copilot:walkthrough)
<!-- List the changes and why they were made -->

## Checklist <!-- Put an `x` in all the boxes that apply. -->

- [ ] I've read this template
- [ ] I've checked reviewed this PR myself, ensuring consistency and quality with the rest of the project
- [ ] I've given a good reason as to why this PR exposes new / removes existing user data
14 changes: 4 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ '8.0', 8.1, 8.2 ]
laravel: [ 9, 10 ]
exclude:
- php: '8.0'
laravel: 10
php: [ 8.1, 8.2 ]
laravel: [ 10 ]

name: Run Tests – PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand Down Expand Up @@ -50,13 +47,10 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ '8.0', 8.1, 8.2 ]
laravel: [ 9, 10 ]
php: [ 8.1, 8.2 ]
laravel: [ 10 ]
stack: [ inertia, livewire ]
tester: [ phpunit, pest ]
exclude:
- php: '8.0'
laravel: 10

name: Test Stubs - PHP ${{matrix.php }} – Laravel ${{ matrix.laravel }} - ${{ matrix.stack }} – ${{ matrix.tester }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Socialstream is a third-party package for [Laravel Jetstream](https://github.com

If you are unfamiliar with Laravel Socialite, it is strongly advised that you take a look at the [official documentation](https://laravel.com/docs/socialite).

> :warning: Socialstream, like Jetstream, should only be installed on NEW applications, installing Socialstream into an existing application will break your applications functionality. It is strongly advised against installing this package within an existing applications.
> :warning: Socialstream, like Jetstream, should only be installed on NEW applications, installing Socialstream into an existing application is unsupported and may lead to undesirable functionality and problems. To install into a new Laravel application, please `composer require` this package **immediately** after running `laravel new MyApp` or `composer create-project laravel/laravel MyApp`.
## Official Documentation

Expand Down
47 changes: 0 additions & 47 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,53 +231,6 @@ class UpdateConnectedAccountsTable extends Migration

```

#### Current Connected Account Context

When you login using a social provider, Socialstream will now set the context for the most-recent, or "current" provider being used. To do this, a new `current_connected_account_id` column will need adding to your users table.

Generate a new `users` migration:

```sh
php artisan make:migration update_users_table --table=users
```

The migration should be popuplated with the following content:

```php
<?php

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

class UpdateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->foreignId('current_connected_account_id')->after('current_team_id')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
//
});
}
}
```

#### Create Connected Account Action

Socialstream 2.x adds a new action for creating connected accounts on registration with a provider. You should copy the new [CreateConnectedAccount](https://github.com/joelbutcher/socialstream/blob/2.x/stubs/app/Actions/Socialstream/CreateConnectedAccount.php) action to the `App/Actions/Socialstream` directory in your project.
Expand Down
43 changes: 21 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
{
"name": "joelbutcher/socialstream",
"description": "A simple Socialite implementation for Laravel Jetstream.",
"description": "Get started with OAuth and Laravel",
"keywords": [
"socialstream",
"laravel",
"jetstream",
"laravel jetstream",
"laravel socialite",
"socialite",
"jetstream socialite",
"tailwind",
"oauth",
"laravel oauth",
"laravel livewire",
"inertia",
"vue"
"oauth"
],
"license": "MIT",
"support": {
Expand All @@ -28,19 +19,15 @@
}
],
"require": {
"php": "^8.0.2",
"doctrine/dbal": "^3.0",
"illuminate/support": "^9.21|^10.0",
"laravel/jetstream": "^2.16.2|^3.0",
"laravel/socialite": "^5.6"
"php": "^8.1",
"laravel/prompts": "^0.1.10",
"laravel/socialite": "^5.9"
},
"require-dev": {
"inertiajs/inertia-laravel": "^0.6.4",
"laravel/sanctum": "^2.7|^3.2",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^7.0|^8.0",
"pestphp/pest": "^1.22",
"phpunit/phpunit": "^9.5"
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
Expand All @@ -50,7 +37,19 @@
"autoload-dev": {
"psr-4": {
"JoelButcher\\Socialstream\\Tests\\": "tests/",
"App\\": "stubs/app/"
"Database\\Factories\\": [
"stubs/database/factories",
"stubs/breeze/database/factories",
"stubs/jetstream/database/factories",
"stubs/filament/database/factories"
],
"App\\": [
"stubs/app/",
"stubs/breeze/default/app/",
"stubs/breeze/inertia-common/app/",
"stubs/jetstream/app/",
"stubs/filament/app/"
]
}
},
"extra": {
Expand Down
36 changes: 0 additions & 36 deletions config/socialstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,10 @@
use JoelButcher\Socialstream\Providers;

return [

/*
|--------------------------------------------------------------------------
| Socialstream Route Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Socialstream will assign to the
| routes that it registers with the application. When necessary, you may
| modify these middleware; however, this default value is usually sufficient.
|
*/

'middleware' => ['web'],

/*
|--------------------------------------------------------------------------
| Socialstream Providers
|--------------------------------------------------------------------------
|
| Here you may specify the providers your application supports for OAuth.
| Out of the box, Socialstream provides support for all of the OAuth
| providers that are supported by Laravel Socialite.
|
*/

'providers' => [
// Providers::github(),
],

/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of Socialstreams's features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/

'features' => [
// Features::createAccountOnFirstLogin(),
// Features::generateMissingEmails(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

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

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};
13 changes: 4 additions & 9 deletions database/migrations/2014_10_12_000000_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
Expand All @@ -21,19 +19,16 @@ public function up()
$table->string('password')->nullable();
$table->rememberToken();
$table->foreignId('current_team_id')->nullable();
$table->foreignId('current_connected_account_id')->nullable();
$table->text('profile_photo_path')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('users');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateConnectedAccountsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('connected_accounts', function (Blueprint $table) {
$table->id();
Expand All @@ -36,11 +34,9 @@ public function up()

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('connected_accounts');
}
}
};
16 changes: 7 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
<phpunit
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Socialstream Test Suite">
Expand Down
29 changes: 29 additions & 0 deletions routes/socialstream-inertia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use Illuminate\Support\Facades\Route;
use JoelButcher\Socialstream\Http\Controllers\Inertia\PasswordController;
use JoelButcher\Socialstream\Http\Controllers\Inertia\ConnectedAccountController;
use JoelButcher\Socialstream\Http\Controllers\Inertia\UpdateUserProfilePhotoController;
use JoelButcher\Socialstream\Http\Controllers\OAuthController;
use JoelButcher\Socialstream\Socialstream;
use Laravel\Jetstream\Jetstream;

Route::group(['middleware' => config('socialstream.middleware', ['web'])], function () {
Route::get('/oauth/{provider}', [OAuthController::class, 'redirect'])->name('oauth.redirect');
Route::get('/oauth/{provider}/callback', [OAuthController::class, 'callback'])->name('oauth.callback');
Route::post('/oauth/{provider}/callback', [OAuthController::class, 'callback'])->name('oauth.callback');

Route::delete('/user/connected-account/{id}', [ConnectedAccountController::class, 'destroy'])
->middleware(['auth'])
->name('connected-accounts.destroy');

Route::post('/user/set-password', [PasswordController::class, 'store'])
->middleware(['auth'])
->name('user-password.set');

if (Socialstream::hasProviderAvatarsFeature() && Jetstream::managesProfilePhotos()) {
Route::put('/user/profile-photo', [UpdateUserProfilePhotoController::class, '__invoke'])
->middleware(['auth'])
->name('user-profile-photo.set');
}
});
Loading

0 comments on commit bb100b8

Please sign in to comment.