helbnt's avatar
Level 4

Other Social Media Options for Profiles?

Hello all!

Pretty new to Laracasts, and was digging into my profile looking to flesh it out a bit. For personal reasons, I refuse to use Twitter (cough), and wondered if other options, such as Mastodon, Bluesky, or Threads might be considered?

Great site, great courses, I'm learning a ton (And am overwhelmed, but loving it!).

0 likes
1 reply
LaryAI's avatar
Level 58

To address the question of adding other social media options to a profile, such as Mastodon, Bluesky, or Threads, you would typically need to modify the user profile settings in the application. Here's a general approach to how you might implement this in a web application:

  1. Database Changes:

    • Add new fields to the user profile table to store URLs or usernames for the additional social media platforms.
    ALTER TABLE user_profiles
    ADD COLUMN mastodon VARCHAR(255),
    ADD COLUMN bluesky VARCHAR(255),
    ADD COLUMN threads VARCHAR(255);
    
  2. Backend Logic:

    • Update the user model to include these new fields.
    • Ensure that the application logic for updating user profiles includes these fields.
    // Assuming a Laravel model
    class UserProfile extends Model
    {
        protected $fillable = [
            'mastodon',
            'bluesky',
            'threads',
            // other fields...
        ];
    }
    
  3. Frontend Form:

    • Update the profile edit form to include input fields for the new social media options.
    <form method="POST" action="/profile/update">
        <!-- Other profile fields -->
        <label for="mastodon">Mastodon</label>
        <input type="text" id="mastodon" name="mastodon" value="{{ old('mastodon', $user->profile->mastodon) }}">
    
        <label for="bluesky">Bluesky</label>
        <input type="text" id="bluesky" name="bluesky" value="{{ old('bluesky', $user->profile->bluesky) }}">
    
        <label for="threads">Threads</label>
        <input type="text" id="threads" name="threads" value="{{ old('threads', $user->profile->threads) }}">
    
        <button type="submit">Update Profile</button>
    </form>
    
  4. Validation:

    • Add validation rules to ensure the data is correctly formatted.
    $request->validate([
        'mastodon' => 'nullable|url',
        'bluesky' => 'nullable|url',
        'threads' => 'nullable|url',
    ]);
    
  5. Display on Profile:

    • Update the profile view to display links to these social media profiles if they are provided.
    <div class="social-media-links">
        @if($user->profile->mastodon)
            <a href="{{ $user->profile->mastodon }}" target="_blank">Mastodon</a>
        @endif
        @if($user->profile->bluesky)
            <a href="{{ $user->profile->bluesky }}" target="_blank">Bluesky</a>
        @endif
        @if($user->profile->threads)
            <a href="{{ $user->profile->threads }}" target="_blank">Threads</a>
        @endif
    </div>
    

By following these steps, you can extend the user profile functionality to include additional social media options. This approach assumes you have a basic understanding of web development and are using a framework like Laravel, but the general principles can be adapted to other frameworks or custom-built applications.

Please or to participate in this conversation.