This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Davis
authored
Oct 23, 2016
1 parent
f7fe8ca
commit 1308eea
Showing
10 changed files
with
309 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
namespace Davis\SocialProfile; | ||
|
||
use Illuminate\Contracts\Events\Dispatcher; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
use Flarum\Database\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
|
31 changes: 16 additions & 15 deletions
31
migrations/2016_10_20_000000_create_socialbuttons_column.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
use Flarum\Database\Migration; | ||
|
||
return Migration::addColumns('users', [ | ||
'social_buttons' => ['longText', 'nullable' => true], | ||
]); | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
use Flarum\Database\Migration; | ||
|
||
return Migration::addColumns('users', [ | ||
'social_buttons' => ['longText', 'nullable' => true], | ||
]); |
61 changes: 31 additions & 30 deletions
61
migrations/2016_10_21_000000_migrate_data_to_user_column.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
use Illuminate\Database\ConnectionInterface; | ||
|
||
return [ | ||
'up' => function (ConnectionInterface $db) { | ||
$results = $db->table('socialbuttons')->get(); | ||
foreach ($results as $result) { | ||
$db->table('users') | ||
->where('id', $result->user_id) | ||
->update(['social_buttons' => $result->buttons]); | ||
} | ||
}, | ||
'down' => function (ConnectionInterface $db) { | ||
$results = $db->table('users')->select('social_buttons')->get(); | ||
foreach ($results as $result) { | ||
$db->table('socialbuttons')->insert( | ||
['user_id' => $result->id, 'buttons' => $result->social_buttons] | ||
); | ||
} | ||
}, | ||
]; | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
use Illuminate\Database\ConnectionInterface; | ||
|
||
return [ | ||
'up' => function (ConnectionInterface $db) { | ||
$results = $db->table('socialbuttons')->get(); | ||
foreach ($results as $result) { | ||
$db->table('users') | ||
->where('id', $result->user_id) | ||
->update(['social_buttons' => $result->buttons]); | ||
} | ||
}, | ||
'down' => function (ConnectionInterface $db) { | ||
$results = $db->table('users')->select('social_buttons')->get(); | ||
foreach ($results as $result) { | ||
$db->table('socialbuttons')->insert( | ||
['user_id' => $result->id, 'buttons' => $result->social_buttons] | ||
); | ||
} | ||
}, | ||
]; |
51 changes: 26 additions & 25 deletions
51
migrations/2016_10_22_000000_drop_socialbuttons_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Schema\Builder; | ||
|
||
return [ | ||
'up' => function (Builder $schema) { | ||
$schema->drop('socialbuttons'); | ||
}, | ||
'down' => function (Builder $schema) { | ||
$schema->create('socialbuttons', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->integer('user_id')->unsigned(); | ||
$table->longText('buttons'); | ||
}); | ||
}, | ||
]; | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Schema\Builder; | ||
|
||
return [ | ||
'up' => function (Builder $schema) { | ||
$schema->drop('socialbuttons'); | ||
}, | ||
'down' => function (Builder $schema) { | ||
$schema->create('socialbuttons', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->integer('user_id')->unsigned(); | ||
$table->longText('buttons'); | ||
}); | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* (c) Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
namespace Davis\SocialProfile\Events; | ||
|
||
use Flarum\Core\User; | ||
|
||
class UserButtonsWereChanged | ||
{ | ||
/** | ||
* @var User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* @var User | ||
*/ | ||
public $actor; | ||
|
||
/** | ||
* @param User $user | ||
* @param User $actor | ||
*/ | ||
public function __construct(User $user, User $actor = null) | ||
{ | ||
$this->user = $user; | ||
$this->actor = $actor; | ||
} | ||
} | ||
<?php | ||
|
||
/* | ||
* This file is part of davis/flarum-ext-socialprofile | ||
* | ||
* © Connor Davis <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the MIT license | ||
*/ | ||
|
||
|
||
namespace Davis\SocialProfile\Events; | ||
|
||
use Flarum\Core\User; | ||
|
||
class UserButtonsWereChanged | ||
{ | ||
/** | ||
* @var User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* @var User | ||
*/ | ||
public $actor; | ||
|
||
/** | ||
* @param User $user | ||
* @param User $actor | ||
*/ | ||
public function __construct(User $user, User $actor = null) | ||
{ | ||
$this->user = $user; | ||
$this->actor = $actor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.