2017 © Pedro Peláez
 

library attach-social-account

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

image

lartie/attach-social-account

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

  • Thursday, August 4, 2016
  • by lartie
  • Repository
  • 2 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Attach Social Account For Laravel 5.2

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock, (*1)

Installation

Composer

composer require lartie/attach-social-account

Service Provider

Add the package to your application service providers in config/app.php file., (*2)

'providers' => [

    /*
     * Application Service Providers..
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
    ...

    /*
     * Extensions
     */
    LArtie\AttachSocialAccount\ServiceProvider::class,

],

Config File And Migrations

Publish the package config file and migrations to your application. Run these commands inside your terminal., (*3)

php artisan vendor:publish

And also run migrations., (*4)

php artisan migrate

This uses the default users table which is in Laravel. You should already have the migration file for the users table available and migrated., (*5)

HasSocialAccount Trait And Contract

Include HasSocialAccount trait and also implement HasSocialAccount contract inside your User model., (*6)

use LArtie\AttachSocialAccount\Core\Traits\HasSocialAccount;
use LArtie\AttachSocialAccount\Core\Contracts\HasSocialAccount as HasSocialAccountContract;

class User extends Authenticatable implements HasSocialAccountContract
{
    use HasSocialAccount;

And that's it!, (*7)

Usage

 $user = User::first();

 $vkData = [
     'token' => 'token',
     'uid' => 'user_id',
     'nickname' => 'username',
     'name' => 'first name and last name',
     'email' => 'example@gmail.com',
     'avatar' => 'link_to',
 ];

Creating Social Network

$socialNetwork = SocialNetworks::create([
    'provider' => 'vkontakte', 
    'short_name' => 'vk'
]);

Attach Social Account

$user->attachSocialAccountById($socialNetwork->id, $vkData);

or, (*8)

$user->attachSocialAccountByShortName('vk', $vkData);

or, (*9)

$user->attachSocialAccountByProvider('vkontakte', $vkData);

Detach Social Account

$user->detachSocialAccountById($socialNetwork->id);

or, (*10)

$user->detachSocialAccountByShortName('vk');

or, (*11)

$user->detachSocialAccountByProvider('vkontakte');

Checking

$user->hasSocialAccountById($socialNetwork->id);

or, (*12)

$user->hasSocialAccountByShortName('vk');

or, (*13)

$user->hasSocialAccountByProvider('vkontakte');

Blade Extensions

@providerExists('vkontakte') {
// see detach button, etc..
}

@providerNotExists('vkontakte') {
// see attach button, etc.. 
}

For more information visit trait HasSocialAccount or contract HasSocialAccount, (*14)

License

This package is free software distributed under the terms of the MIT license., (*15)

The Versions

04/08 2016

dev-master

9999999-dev

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

  Sources   Download

MIT

laravel social illuminate attach-social social-account

04/08 2016

v0.1.1

0.1.1.0

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

  Sources   Download

MIT

laravel social illuminate attach-social social-account

12/04 2016

v0.1

0.1.0.0

Пакет для подключения аккаунтов социальный сетей к пользователю для Laravel 5.2

  Sources   Download

MIT

laravel social illuminate attach-social social-account