Level 3
Nvm solved it by changing the profileurl type to longText. https://laravel.com/docs/5.8/migrations
1 like
"Invalid value." at position 0 in value for column 'steams.profileurl'. I recently switch from sqlite to mysql where I am using laragon right now. Back then when the database file was in sqlite everything works fine. Any idea why this is happening?
(Migration files)
public function up()
{
Schema::create('steams', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('profile_id');
$table->json('steamid')->nullable();
$table->json('profileurl')->nullable();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('profile_id')->references('id')->on('profiles');
});
}
(SteamController)
public function redirectToProvider($provider)
{
return Socialite::with($provider)->redirect();
}
public function handleProviderCallback($provider, Steam $steam)
{
$data = Socialite::driver($provider)->user();
$steam = new Steam();
$steam->user_id = auth()->user()->id;
$steam->profile_id = auth()->user()->profile->id;
$steam->steamid = $data->user['steamid'];
$steam->profileurl = $data->user['profileurl'];
$steam->save();
return redirect('/home')->with('success', 'Steam Connected');
}
(Steam Model)
class Steam extends Model
{
protected $fillable = ['user_id', 'profile_id', 'steamid', 'profileurl'];
public function user()
{
return $this->belongsTo('App\User');
}
public function profile()
{
return $this->belongsTo('App\Profile');
}
}
(PhpMyAdmin)
Nvm solved it by changing the profileurl type to longText. https://laravel.com/docs/5.8/migrations
Please or to participate in this conversation.