Wallogit.com
2017 © Pedro Peláez
This Laravel 4 package provides a command. These generator include:, (*1)
follow:model, (*2)
Begin by installing this package through Composer. Edit your project's composer.json file to require dutkan/followers., (*3)
"require": {
"laravel/framework": "4.1.*",
"dutkan/followers": "dev-develop"
}
Next, update Composer from the Terminal:, (*4)
composer update
Once this operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array., (*5)
'Dutkan\Followers\FollowersServiceProvider'
You can installing the package' s migration file into your application, by running the follwing command:, (*6)
php artisan migrate --package="dutkan/followers"
That's it! You're all set to go. Run the artisan command from the Terminal to see the new follow:model commands., (*7)
php artisan follow:model Follow
After installing, you can publish the package's configuration file into your application, by running the following command:, (*8)
php artisan config:publish dutkan/followers
This will publish the config file to app/config/packages/dutkan/followers/config.php where you modify the package configuration., (*9)
To add the current user's followers, (*10)
try {
$follow = Follower::followTo(1);
return Redirect::to('/');
} catch (Dutkan\Followers\Exceptions\AuthenticationException $e) {
return $e->getMessage();
}
or remove the current user's followers, (*11)
try {
$follow = Follower::unfollowFrom(1);
return Redirect::to('/');
} catch (Dutkan\Followers\Exceptions\AuthenticationException $e) {
return $e->getMessage();
}