Skip to content

Instantly share code, notes, and snippets.

@andyyou
andyyou / Markdium-Hack.php
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
// app/Actions/Fortify/CreateNewUser.php
['required', 'string', 'email', 'max:255', 'unique:users,email,NULL,id,deleted_at,NULL'],
// ...
])->validate();
return DB::transaction(function () use ($input) {
return tap(User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ composer require laravel/socialite
# (opt) If you meet memory limit error, place `COMPOSER_MEMORY_LIMIT=-1` before command
# $ COMPOSER_MEMORY_LIMIT=-1 composer require laravel/socialite
@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ php artisan make:controller Auth/LoginController
@andyyou
andyyou / Markdium-Hack.php
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropUnique(['email']);
$table->string('password')->nullable()->change();
$table->json('social')->nullable();
$table->softDeletes();
$table->unique(['email', 'deleted_at']);
});
}
@andyyou
andyyou / Markdium-Hack.php
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
use Illuminate\Database\Eloquent\SoftDeletes;
use SoftDeletes;
protected $casts = [
'email_verified_at' => 'datetime',
'social' => 'array',
];
@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
# 1. Create project
$ laravel new demo
# 2. Install jetstream with teams
$ composer require laravel/jetstream
$ php artisan jetstream:install inertia --teams
$ npm install && npm run dev
# (opt) For customize template you should publish these views
$ php artisan vendor:publish --tag=jetstream-views
@andyyou
andyyou / Markdium-JavaScript.js
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ composer require doctrine/dbal
$ php artisan make:migration edit_columns_in_users_table
@andyyou
andyyou / Markdium-Hack.php
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
// app/Actions/Fortify/UpdateUserProfileInformaiton.php
['required', 'email', 'max:255', 'unique:users,email,NULL,id,deleted_at,NULL'],
// ...
])->validateWithBag('updateProfileInformation');
// ...
}
// ...
}
@andyyou
andyyou / Markdium-Hack.php
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropUnique(['email']);
$table->string('password')->nullable()->change();
$table->json('social')->nullable();
$table->softDeletes();
$table->unique(['email', 'deleted_at']);
});
}
@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ php artisan migrate