Permalink
Browse files

add demo site, gitignore modified, fix bugs, site verification, and g…

…oogle analytics tracker. comment attached to document. vote feature attached on comment. and many others. add slack reporting. Doc model changed to Lesson. Repository pattern implemented for markdown based models.
  • Loading branch information...
appkr committed Dec 6, 2015
1 parent 962bf9b commit c2b59710a4261917dde9af7bb897deaf9b813f4b
Showing with 34,385 additions and 16,708 deletions.
  1. +4 −1 .env.example
  2. +1 −1 .gitignore
  3. +23 −7 Envoy.blade.php
  4. +2 −0 GLOSSARY.md
  5. +21 −0 LICENSE
  6. +40 −4 app/Article.php
  7. +16 −0 app/AuthorTrait.php
  8. +37 −7 app/Comment.php
  9. +65 −0 app/Console/Commands/BackupDb.php
  10. +39 −0 app/Console/Commands/ClearLog.php
  11. +44 −0 app/Console/Commands/UpdateLessonsTable.php
  12. +10 −2 app/Console/Kernel.php
  13. +0 −75 app/Document.php
  14. +8 −5 app/Exceptions/Handler.php
  15. +18 −16 app/Http/Controllers/ArticlesController.php
  16. +1 −1 app/Http/Controllers/AttachmentsController.php
  17. +66 −5 app/Http/Controllers/CommentsController.php
  18. +2 −1 app/Http/Controllers/Controller.php
  19. +0 −72 app/Http/Controllers/DocumentsController.php
  20. +89 −0 app/Http/Controllers/LessonsController.php
  21. +1 −1 app/Http/Controllers/SessionsController.php
  22. +1 −0 app/Http/Controllers/SocialController.php
  23. +23 −3 app/Http/Controllers/UsersController.php
  24. +2 −1 app/Http/Controllers/WelcomeController.php
  25. +1 −1 app/Http/Middleware/AuthorOnly.php
  26. +26 −10 app/Http/routes.php
  27. +40 −0 app/Lesson.php
  28. +27 −6 app/Listeners/CommentsHandler.php
  29. +2 −0 app/Providers/AppServiceProvider.php
  30. +3 −1 app/Providers/RouteServiceProvider.php
  31. +74 −0 app/Reporters/Slack.php
  32. +26 −0 app/Repositories/LessonRepository.php
  33. +220 −0 app/Repositories/MarkdownRepository.php
  34. +23 −0 app/Repositories/RepositoryInterface.php
  35. +9 −1 app/Services/Markdown.php
  36. +5 −2 app/User.php
  37. +32 −0 app/Vote.php
  38. +21 −2 app/helpers.php
  39. +3 −2 bower.json
  40. +6 −2 composer.json
  41. +1 −1 config/app.php
  42. +2 −1 config/icons.php
  43. +1 −1 config/services.php
  44. +1 −1 config/session.php
  45. +1 −1 database/factories/ModelFactory.php
  46. +2 −1 database/migrations/2015_11_20_062500_create_comments_table.php
  47. +3 −1 database/migrations/2015_11_20_062513_create_articles_table.php
  48. +37 −0 database/migrations/2015_12_09_165930_create_lessons_table.php
  49. +37 −0 database/migrations/2015_12_10_151357_create_votes_table.php
  50. +32 −4 database/seeds/DatabaseSeeder.php
  51. +0 −50 docs/index.md
  52. +26 −22 gulpfile.js
  53. +3 −2 {docs → lessons}/01-welcome.md
  54. BIN {docs → lessons}/02-hello-laravel-img-01.png
  55. BIN {docs → lessons}/02-hello-laravel-img-01.pptx
  56. BIN {docs → lessons}/02-hello-laravel-img-02.png
  57. BIN lessons/02-hello-laravel-img-03.png
  58. BIN lessons/02-hello-laravel-img-03.pptx
  59. +12 −3 {docs → lessons}/02-hello-laravel.md
  60. +3 −2 {docs → lessons}/02-install-on-windows.md
  61. +3 −2 {docs → lessons}/03-configuration.md
  62. BIN {docs → lessons}/04-routing-basic-img-01.png
  63. +2 −1 {docs → lessons}/04-routing-basics.md
  64. +2 −1 {docs → lessons}/05-pass-data-to-view.md
  65. +3 −2 {docs → lessons}/06-blade-101.md
  66. +2 −1 {docs → lessons}/07-blade-201.md
  67. BIN {docs → lessons}/08-raw-queries-img-01.png
  68. +2 −1 {docs → lessons}/08-raw-queries.md
  69. +2 −1 {docs → lessons}/09-query-builder.md
  70. +2 −1 {docs → lessons}/10-eloquent.md
  71. +3 −2 {docs → lessons}/11-migration.md
  72. +2 −1 {docs → lessons}/12-controller.md
  73. BIN {docs → lessons}/13-restful-resource-controller-img-01.png
  74. BIN {docs → lessons}/13-restful-resource-controller-img-02.png
  75. +3 −2 {docs → lessons}/13-restful-resource-controller.md
  76. +3 −2 {docs → lessons}/14-named-routes.md
  77. BIN {docs → lessons}/15-nested-resources-img-01.png
  78. +3 −2 {docs → lessons}/15-nested-resources.md
  79. +3 −2 {docs → lessons}/16-authentication.md
  80. +2 −1 {docs → lessons}/17-authentication-201.md
  81. +2 −1 {docs → lessons}/18-eloquent-relationships.md
  82. +3 −2 {docs → lessons}/19-seeder.md
  83. BIN {docs → lessons}/20-1-pagination-img-01.png
  84. +3 −2 {docs → lessons}/20-1-pagination.md
  85. BIN {docs → lessons}/20-eager-loading-img-01.png
  86. +3 −2 {docs → lessons}/20-eager-loading.md
  87. BIN {docs → lessons}/21-mail-img-01.png
  88. +2 −1 {docs → lessons}/21-mail.md
  89. BIN {docs → lessons}/22-events-img-01.png
  90. +2 −2 {docs → lessons}/22-events.md
  91. +2 −1 {docs → lessons}/23-validation.md
  92. BIN {docs → lessons}/24-exception-handling-img-01.png
  93. +3 −2 {docs → lessons}/24-exception-handling.md
  94. BIN {docs → lessons}/25-composer-img-01.png
  95. +3 −2 {docs → lessons}/25-composer.md
  96. BIN {docs → lessons}/26-document-model-img-01.png
  97. BIN {docs → lessons}/26-document-model-img-02.png
  98. +2 −1 {docs → lessons}/26-document-model.md
  99. BIN {docs → lessons}/27-document-controller-img-01.png
  100. +4 −3 {docs → lessons}/27-document-controller.md
  101. +3 −2 {docs → lessons}/28-cache.md
  102. BIN {docs → lessons}/29-elixir-img-01.png
  103. BIN {docs → lessons}/29-elixir-img-02.png
  104. +2 −1 {docs → lessons}/29-elixir.md
  105. BIN {docs → lessons}/30-final-touch-img-01.png
  106. BIN {docs → lessons}/30-final-touch-img-02.png
  107. BIN {docs → lessons}/30-final-touch-img-03.png
  108. +2 −1 {docs → lessons}/30-final-touch.md
  109. +3 −2 {docs → lessons}/31-forum-features.md
  110. BIN {docs → lessons}/32-login-img-01.png
  111. BIN {docs → lessons}/32-login-img-02.png
  112. BIN {docs → lessons}/32-login-img-03.png
  113. BIN {docs → lessons}/32-login-img-04.png
  114. BIN {docs → lessons}/32-login-img-05.png
  115. BIN {docs → lessons}/32-login-img-06.png
  116. BIN {docs → lessons}/32-login-img-07.png
  117. +3 −2 {docs → lessons}/32-login.md
  118. BIN {docs → lessons}/32n33-auth-refactoring-img-01.png
  119. BIN {docs → lessons}/32n33-auth-refactoring-img-02.png
  120. BIN {docs → lessons}/32n33-auth-refactoring-img-02.pptx
  121. +3 −2 {docs → lessons}/32n33-auth-refactoring.md
  122. BIN {docs → lessons}/33-social-login-img-01.png
  123. BIN {docs → lessons}/33-social-login-img-02.png
  124. BIN {docs → lessons}/33-social-login-img-03.png
  125. BIN {docs → lessons}/33-social-login-img-04.png
  126. BIN {docs → lessons}/33-social-login-img-05.png
  127. BIN {docs → lessons}/33-social-login-img-06.png
  128. +2 −1 {docs → lessons}/33-social-login.md
  129. +2 −1 {docs → lessons}/34-role.md
  130. BIN {docs → lessons}/35-locale-img-01.png
  131. BIN {docs → lessons}/35-locale-img-02.png
  132. +2 −1 {docs → lessons}/35-locale.md
  133. BIN {docs → lessons}/36-models-img-01.png
  134. BIN {docs → lessons}/36-models-img-02.png
  135. +3 −2 {docs → lessons}/36-models.md
  136. BIN {docs → lessons}/37-articles-img-01.png
  137. BIN {docs → lessons}/37-articles-img-02.png
  138. BIN {docs → lessons}/37-articles-img-03.png
  139. BIN {docs → lessons}/37-articles-img-04.png
  140. +4 −3 {docs → lessons}/37-articles.md
  141. BIN {docs → lessons}/38-tags-img-01.png
  142. BIN {docs → lessons}/38-tags-img-02.png
  143. BIN {docs → lessons}/38-tags-img-03.png
  144. +3 −2 {docs → lessons}/38-tags.md
  145. BIN {docs → lessons}/39-attachments-img-01.png
  146. BIN {docs → lessons}/39-attachments-img-02.png
  147. BIN {docs → lessons}/39-attachments-img-03.png
  148. BIN {docs → lessons}/39-attachments-img-04.png
  149. BIN {docs → lessons}/39-attachments-img-05.png
  150. +3 −2 {docs → lessons}/39-attachments.md
  151. BIN {docs → lessons}/40-comments-img-01.png
  152. BIN {docs → lessons}/40-comments-img-02.png
  153. BIN {docs → lessons}/40-comments-img-03.png
  154. +3 −2 {docs → lessons}/40-comments.md
  155. BIN {docs → lessons}/41-ui-makeup-img-01.png
  156. BIN {docs → lessons}/41-ui-makeup-img-02.png
  157. BIN {docs → lessons}/41-ui-makeup-img-03.png
  158. BIN {docs → lessons}/41-ui-makeup-img-04.png
  159. BIN {docs → lessons}/41-ui-makeup-img-05.png
  160. BIN {docs → lessons}/41-ui-makeup-img-06.png
  161. +3 −2 {docs → lessons}/41-ui-makeup.md
  162. BIN {docs → lessons}/42-be-makeup-img-01.png
  163. BIN {docs → lessons}/42-be-makeup-img-02.png
  164. +9 −7 {docs → lessons}/42-be-makeup.md
  165. BIN lessons/43-change-note-img-01.png
  166. BIN lessons/43-change-note-img-02.png
  167. BIN lessons/43-change-note-img-03.png
  168. BIN lessons/43-change-note-img-04.png
  169. BIN lessons/43-change-note-img-05.png
  170. BIN lessons/43-change-note-img-06.png
  171. +935 −0 lessons/43-change-note.md
  172. +2 −0 lessons/GLOSSARY.md
  173. +50 −0 lessons/INDEX.md
  174. +113 −0 lessons/README.md
  175. +50 −0 lessons/SUMMARY.md
  176. +2 −0 public/attachments/.gitignore
  177. +0 −9,156 public/build/css/app-b37482d56a.css
  178. +822 −67 public/build/css/{app-5d00a1c8b0.css → app-bd7b9f4237.css}
  179. +1 −1 public/build/css/app.css.map
  180. +6,836 −6,663 public/build/js/{app-d7021d7fde.js → app-da95cae128.js}
  181. +1 −1 public/build/js/app.js.map
  182. +2 −2 public/build/rev-manifest.json
  183. BIN public/images/419042.jpg
  184. BIN public/images/459033.jpg
  185. BIN public/images/510930.jpg
  186. +7,782 −0 public/images/icon_beginner_course.svg
  187. +7,717 −0 public/images/icon_intermediate_course.svg
  188. +7,709 −0 public/images/icon_realworld_course.svg
  189. BIN public/images/{laravel_logo.png → logo_laravel.png}
  190. +57 −45 readme.md
  191. +10 −4 resources/assets/js/app.js
  192. +51 −2 resources/assets/sass/_commons.scss
  193. +32 −0 resources/assets/sass/_forum.scss
  194. +88 −0 resources/assets/sass/_landing.scss
  195. +16 −7 resources/assets/sass/{_documents.scss → _lessons.scss}
  196. +92 −2 resources/assets/sass/_mediaquery.scss
  197. +3 −1 resources/assets/sass/app.scss
  198. +1 −1 resources/lang/en/auth.php
  199. +22 −0 resources/lang/en/common.php
  200. +0 −8 resources/lang/en/documents.php
  201. +1 −0 resources/lang/en/errors.php
  202. +22 −15 resources/lang/en/forum.php
  203. +8 −0 resources/lang/en/lessons.php
  204. +5 −5 resources/lang/ko/auth.php
  205. +22 −0 resources/lang/ko/common.php
  206. +0 −8 resources/lang/ko/documents.php
  207. +2 −1 resources/lang/ko/errors.php
  208. +22 −15 resources/lang/ko/forum.php
  209. +8 −0 resources/lang/ko/lessons.php
  210. +2 −2 resources/views/articles/create.blade.php
  211. +2 −2 resources/views/articles/edit.blade.php
  212. +6 −4 resources/views/articles/index.blade.php
  213. +7 −1 resources/views/articles/partial/article.blade.php
  214. +25 −13 resources/views/articles/partial/form.blade.php
  215. +1 −1 resources/views/articles/partial/search.blade.php
  216. +6 −6 resources/views/articles/show.blade.php
  217. +34 −8 resources/views/comments/index.blade.php
  218. +85 −40 resources/views/comments/partial/comment.blade.php
  219. +3 −3 resources/views/comments/partial/control.blade.php
  220. +3 −3 resources/views/comments/partial/create.blade.php
  221. +3 −3 resources/views/comments/partial/edit.blade.php
  222. +9 −0 resources/views/comments/partial/login.blade.php
  223. +0 −30 resources/views/documents/index.blade.php
  224. +11 −2 resources/views/emails/new-comment.blade.php
  225. +230 −17 resources/views/home.blade.php
  226. +0 −31 resources/views/index.blade.php
  227. +12 −1 resources/views/layouts/master.blade.php
  228. +1 −1 resources/views/layouts/partial/flash_message.blade.php
  229. +1 −1 resources/views/layouts/partial/footer.blade.php
  230. +54 −126 resources/views/layouts/partial/markdown.blade.php
  231. +4 −4 resources/views/layouts/partial/navigation.blade.php
  232. +9 −0 resources/views/layouts/partial/tracker.blade.php
  233. +14 −0 resources/views/lessons/partial/pager.blade.php
  234. +49 −0 resources/views/lessons/show.blade.php
  235. +5 −2 resources/views/sessions/create.blade.php
  236. +2 −2 resources/views/tags/partial/index.blade.php
  237. +1 −1 resources/views/tags/partial/list.blade.php
  238. +7 −4 resources/views/users/create.blade.php
  239. +5 −3 resources/views/users/partial/avatar.blade.php
  240. +2 −0 storage/backup/.gitignore
@@ -16,4 +16,7 @@ MAIL_USERNAME=your_mailgun_login_email
MAIL_PASSWORD=your_mailgun_login_password
GITHUB_ID=your_github_client_id
GITHUB_SECRET=your_github_client_secret
GITHUB_SECRET=your_github_client_secret
GITHUB_CALLBACK=http://localhost/social/github
SLACK_TOKEN=your_slack_token
@@ -5,7 +5,7 @@ Homestead.yaml
Homestead.json
.env
.idea
aws-credentials
aws-credentials*
git_*
.DS_Store
.phpstorm.meta.php
@@ -1,6 +1,6 @@
#--------------------------------------------------------------------------
# List of tasks, that you can run...
# e.g. envoy release
# e.g. envoy run hello
#--------------------------------------------------------------------------
#
# hello Check ssh connection
@@ -9,7 +9,7 @@
# init Initialize Laravel environment
#
@servers(['aws' => 'ec2-52-192-13-191.ap-northeast-1.compute.amazonaws.com'])
@servers(['aws-demo' => 'ec2-52-193-67-224.ap-northeast-1.compute.amazonaws.com', 'homestead' => 'homestead.vm'])
@setup
$projectName = 'l5essential';
@@ -18,19 +18,35 @@
$codePath = $homePath . '/code';
$basePath = $codePath . '/' . $projectName;
$repoUrl = 'git@github.com:appkr/l5essential.git';
$domainName = 'l5essential.appkr.kr';
$domainName = 'l5.appkr.kr';
@endsetup
@task('hello_envoy', ['on' => 'aws'])
@task('hello', ['on' => 'homestead'])
echo "Hello Envoy!";
@endtask
@task('release', ['on' => 'aws', 'confirm' => true])
{{--@after
@slack('https://hooks.slack.com/services/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', '#l5essential', 'Hello Envoy!')
@endafter--}}
@task('hello2', ['on' => 'aws-demo'])
echo "Hello Envoy!";
@endtask
@task('release', ['on' => 'aws-demo', 'confirm' => true])
# pull code from the repository.
cd {{ $basePath }} && git pull;
# composer install;
# ln -nfs ../.env .env
# rm -rf storage
# ln -nfs ../storage storage
# rm -rf bootstrap/cache
# ln -nfs ../cache bootstrap/cache
# rm -rf public/attachments
# ln -nfs ../attachments public/attachments
@endtask
@task('provision', ['on' => 'aws', 'confirm' => true])
@task('provision', ['on' => 'aws-demo', 'confirm' => true])
# curl https://raw.githubusercontent.com/appkr/l5essential/master/provision.sh -O {{ $homePath }}/provision.sh
# curl https://raw.githubusercontent.com/appkr/l5essential/master/serve.sh -O {{ $homePath }}/serve.sh
@@ -41,7 +57,7 @@
{{ $homePath }}/serve.sh {{ $domainName }} {{$basePath}}/public;
@endtask
@task('init', ['on' => 'aws', 'confirm' => true])
@task('init', ['on' => 'aws-demo', 'confirm' => true])
# Make a directory at server, which will house the codes.
if [ ! -d {{ $codePath }} ]; then
mkdir {{ $codePath}};
@@ -0,0 +1,2 @@
# term
Definition for this term
21 LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Appkr <juwonkim@me.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -2,20 +2,56 @@
namespace App;
use Illuminate\Database\Eloquent\SoftDeletes;
class Article extends Model
{
use SoftDeletes;
use AuthorTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'author_id',
'title',
'content',
'notification',
'solution_id'
'solution_id',
'pin',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'author_id',
'solution_id',
'notification'
'notification',
'deleted_at',
'pin',
];
/**
* The relations to eager load on every query.
*
* @var array
*/
protected $with = [
'author',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'deleted_at'
];
/* Relationships */
@@ -59,8 +95,8 @@ public function scopeNotSolved($query)
/* Helpers */
public function isAuthor()
public function isNotice()
{
return $this->author->id == auth()->user()->id;
return $this->pin ? true : false;
}
}
@@ -0,0 +1,16 @@
<?php
namespace App;
trait AuthorTrait
{
/**
* Determine if the current instance was authored by the current user.
*
* @return bool
*/
public function isAuthor()
{
return $this->author->id == auth()->user()->id;
}
}
@@ -2,8 +2,13 @@
namespace App;
use Illuminate\Database\Eloquent\SoftDeletes;
class Comment extends Model
{
use SoftDeletes;
use AuthorTrait;
protected $fillable = [
'commentable_type',
'commentable_id',
@@ -17,9 +22,36 @@ class Comment extends Model
'author_id',
'commentable_type',
'commentable_id',
'parent_id'
'parent_id',
'deleted_at',
];
protected $dates = [
'deleted_at'
];
protected $with = [
'author',
'votes',
];
protected $appends = [
'up_count',
'down_count'
];
/* Accessors */
public function getUpCountAttribute()
{
return (int) static::votes()->sum('up');
}
public function getDownCountAttribute()
{
return (int) static::votes()->sum('down');
}
/* Relationships */
public function author()
@@ -34,18 +66,16 @@ public function commentable()
public function replies()
{
return $this->hasMany(Comment::class, 'parent_id');
return $this->hasMany(Comment::class, 'parent_id')->latest();
}
public function parent()
{
return $this->belongsTo(Comment::class, 'id', 'parent_id');
return $this->belongsTo(Comment::class, 'parent_id', 'id');
}
/* Helpers */
public function isAuthor()
public function votes()
{
return $this->author->id == auth()->user()->id;
return $this->hasMany(Vote::class);
}
}
@@ -0,0 +1,65 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class BackupDb extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'my:backup-db
{user : User name for database login.}
{pass : Password for database login.}
{--S|db=myProject : Database name to backup.}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Execute database backup.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$dir = storage_path('backup');
if (! \File::isDirectory($dir)) {
\File::makeDirectory($dir);
}
$command = sprintf(
'mysqldump %s > %s -u%s -p%s',
$this->option('db'),
storage_path("backup/{$this->option('db')}.sql"),
$this->argument('user'),
$this->argument('pass')
);
system($command);
$now = \Carbon\Carbon::now()->toDateTimeString();
$result = "{$this->getName()} command done at {$now}";
\Log::info($result);
return $this->info($result);
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ClearLog extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'my:clear-log';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Clear Laravel log.';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$path = storage_path('logs/laravel.log');
system('cat /dev/null > ' . $path);
$now = \Carbon\Carbon::now()->toDateTimeString();
$result = "{$this->getName()} command done at {$now}";
\Log::info($result);
return $this->info($result);
}
}
Oops, something went wrong.

0 comments on commit c2b5971

Please sign in to comment.