Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Social Laravel Package

miladimos/laravel-social

View on GitHub
Deep Wiki
Context7

Starts Forks

Laravel social package

A toolkit package for social networks

Installation

  1. Run the command below to add this package:
composer require miladimos/laravel-social
  1. Open your config/socials.php and add the following to the providers array:
Miladimos\Social\Providers\SocialServiceProvider::class,
  1. Run the command below to install package:
php artisan social:install
  1. Run the command below to migrate database:
php artisan migrate

Features

Follow/UnFollow

First add Followable trait to user model


namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Miladimos\Social\Traits\Follows\Followable;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use HasFactory,
        Followable;
}

and enable to you follow/unfollow feature:

namespace App\Http\Controller;

use App\Models\User;

class YourController extends Controller
{
    public function index()
    {   
        $firstUser = User::first();
        $secondUser = User::find(2);

        $firstUser->follow($secondUser);
        $firstUser->unfollow($secondUser);
        $firstUser->toggleFollow($secondUser);

        $firstUser->followers;
        $firstUser->followings;
    }
}

Like

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle