From 96139e13cd7c257ab87fb4c3e0448d47b8fceb2f Mon Sep 17 00:00:00 2001 From: Lucas Pires Date: Fri, 30 Sep 2016 16:53:16 -0300 Subject: [PATCH 01/32] Rename users seeder class name --- .../Users/Database/Seeders/{UserSeeder.php => UsersSeeder.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/Domains/Users/Database/Seeders/{UserSeeder.php => UsersSeeder.php} (90%) diff --git a/app/Domains/Users/Database/Seeders/UserSeeder.php b/app/Domains/Users/Database/Seeders/UsersSeeder.php similarity index 90% rename from app/Domains/Users/Database/Seeders/UserSeeder.php rename to app/Domains/Users/Database/Seeders/UsersSeeder.php index e3b85b2..fdb46f0 100644 --- a/app/Domains/Users/Database/Seeders/UserSeeder.php +++ b/app/Domains/Users/Database/Seeders/UsersSeeder.php @@ -8,7 +8,7 @@ /** * Class UsersSeeders. */ -class UserSeeder extends Seeder +class UsersSeeder extends Seeder { /** * @todo improve users seeders From 6b6b3275768a802469c7e9ca47ea927456d1a766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:37:35 -0300 Subject: [PATCH 02/32] Basic User test --- tests/unit/Domains/Users/UserTest.php | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/unit/Domains/Users/UserTest.php diff --git a/tests/unit/Domains/Users/UserTest.php b/tests/unit/Domains/Users/UserTest.php new file mode 100644 index 0000000..9406074 --- /dev/null +++ b/tests/unit/Domains/Users/UserTest.php @@ -0,0 +1,33 @@ +make([ + 'avatar' => 'foobar.jpg', + ]); + + $this->assertEquals('foobar.jpg?s=30', $user->getAvatarUrl()); + + $user->avatar = 'foobar.jpg?foo=bar'; + + $this->assertEquals('foobar.jpg?foo=bar&s=30', $user->getAvatarUrl()); + } + + /** @test */ + public function it_returns_the_gravatar_url_when_the_user_has_no_avatar() + { + $user = factory(User::class)->make(); + + $expected_url = '//www.gravatar.com/avatar/' . md5($user->email) . '?s=30&d=identicon'; + + $this->assertEquals($expected_url, $user->getAvatarUrl()); + } +} From 509ec20958b964c54f9d07847e9484a0cec11f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:39:37 -0300 Subject: [PATCH 03/32] getAvatarUrl refactor --- app/Domains/Users/User.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Domains/Users/User.php b/app/Domains/Users/User.php index 16adfc0..814a8ed 100644 --- a/app/Domains/Users/User.php +++ b/app/Domains/Users/User.php @@ -62,19 +62,17 @@ class User extends Authenticatable */ public function getAvatarUrl($size = 30) { - $size_query = '?s='.$size; + $size_query = '?s=' . $size; - if (isset($this->attributes['avatar'])) { - $avatar = $this->attributes['avatar']; - - if (str_contains($avatar, '?')) { - $size_query = '&s='.$size; - } + if (!isset($this->avatar)) { + return '//www.gravatar.com/avatar/' . md5($this->email) . $size_query . '&d=identicon'; + } - return $avatar.$size_query; + if (str_contains($this->avatar, '?')) { + $size_query = '&s=' . $size; } - return '//www.gravatar.com/avatar/'.md5($this->email).$size_query.'&d=identicon'; + return $this->avatar . $size_query; } /** From 98c76ebc84550793619636207669d6001ef7af98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:44:15 -0300 Subject: [PATCH 04/32] cs-fixer --- app/Domains/Users/User.php | 8 ++++---- tests/unit/Domains/Users/UserTest.php | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/Domains/Users/User.php b/app/Domains/Users/User.php index 814a8ed..146264c 100644 --- a/app/Domains/Users/User.php +++ b/app/Domains/Users/User.php @@ -62,17 +62,17 @@ class User extends Authenticatable */ public function getAvatarUrl($size = 30) { - $size_query = '?s=' . $size; + $size_query = '?s='.$size; if (!isset($this->avatar)) { - return '//www.gravatar.com/avatar/' . md5($this->email) . $size_query . '&d=identicon'; + return '//www.gravatar.com/avatar/'.md5($this->email).$size_query.'&d=identicon'; } if (str_contains($this->avatar, '?')) { - $size_query = '&s=' . $size; + $size_query = '&s='.$size; } - return $this->avatar . $size_query; + return $this->avatar.$size_query; } /** diff --git a/tests/unit/Domains/Users/UserTest.php b/tests/unit/Domains/Users/UserTest.php index 9406074..9d96dc6 100644 --- a/tests/unit/Domains/Users/UserTest.php +++ b/tests/unit/Domains/Users/UserTest.php @@ -2,11 +2,8 @@ namespace Codecasts\Domains\Users; -use Codecasts\Domains\Users\User; - class UserTest extends \TestCase { - /** @test */ public function it_returns_the_correct_avatar_if_the_user_has_an_avatar() { @@ -26,7 +23,7 @@ public function it_returns_the_gravatar_url_when_the_user_has_no_avatar() { $user = factory(User::class)->make(); - $expected_url = '//www.gravatar.com/avatar/' . md5($user->email) . '?s=30&d=identicon'; + $expected_url = '//www.gravatar.com/avatar/'.md5($user->email).'?s=30&d=identicon'; $this->assertEquals($expected_url, $user->getAvatarUrl()); } From 171ba39c9b3cb98ba4033343e8ae87b89ed1c76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:52:39 -0300 Subject: [PATCH 05/32] Track factory --- .../Database/Factories/TrackFactory.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/Domains/Lessons/Database/Factories/TrackFactory.php diff --git a/app/Domains/Lessons/Database/Factories/TrackFactory.php b/app/Domains/Lessons/Database/Factories/TrackFactory.php new file mode 100644 index 0000000..c059eaa --- /dev/null +++ b/app/Domains/Lessons/Database/Factories/TrackFactory.php @@ -0,0 +1,26 @@ +faker->sentence(4); + + return [ + 'slug' => str_slug($title), + 'title' => $title, + 'description' => $this->faker->sentence(10), + 'visible' => $this->faker->boolean(50), + ]; + } +} From 22c564c60c14dc240963bf02f65f2a4978885169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:57:49 -0300 Subject: [PATCH 06/32] Adds LTrackFactory to DomainServiceProvider --- app/Domains/Lessons/Providers/DomainServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Domains/Lessons/Providers/DomainServiceProvider.php b/app/Domains/Lessons/Providers/DomainServiceProvider.php index 728f217..30f75a7 100644 --- a/app/Domains/Lessons/Providers/DomainServiceProvider.php +++ b/app/Domains/Lessons/Providers/DomainServiceProvider.php @@ -5,6 +5,7 @@ use Codecasts\Domains\Lessons\Contracts\LessonRepository as LessonRepositoryContract; use Codecasts\Domains\Lessons\Contracts\TrackRepository as TrackRepositoryContract; use Codecasts\Domains\Lessons\Database\Factories\LessonFactory; +use Codecasts\Domains\Lessons\Database\Factories\TrackFactory; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonLogsTable; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonsTable; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonsTagsTable; @@ -28,7 +29,7 @@ class DomainServiceProvider extends ServiceProvider protected $bindings = [ LessonRepositoryContract::class => LessonRepository::class, - TrackRepositoryContract::class => TrackRepository::class, + TrackRepositoryContract::class => TrackRepository::class, ]; protected $subProviders = [ @@ -37,5 +38,6 @@ class DomainServiceProvider extends ServiceProvider protected $factories = [ LessonFactory::class, + TrackFactory::class, ]; } From 11283c56316023b166f1dd4d7dbec19bec9cd732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 03:59:23 -0300 Subject: [PATCH 07/32] Basic track model test and refactor --- app/Domains/Lessons/Track.php | 6 ++-- tests/unit/Domains/Lessons/TrackTest.php | 39 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 tests/unit/Domains/Lessons/TrackTest.php diff --git a/app/Domains/Lessons/Track.php b/app/Domains/Lessons/Track.php index 6d4fdd8..3d99a87 100644 --- a/app/Domains/Lessons/Track.php +++ b/app/Domains/Lessons/Track.php @@ -33,14 +33,14 @@ public function lessons() public function firstLessonSlug() { - $lesson = $this->lessons()->first(); + $lesson = $this->lessons->first(); - return ($lesson) ? $lesson->slug : null; + return $lesson->slug ?? null; } public function lessonCount() { - $lessons_count = $this->lessons()->count(); + $lessons_count = $this->lessons->count(); return $lessons_count; } diff --git a/tests/unit/Domains/Lessons/TrackTest.php b/tests/unit/Domains/Lessons/TrackTest.php new file mode 100644 index 0000000..127a5ed --- /dev/null +++ b/tests/unit/Domains/Lessons/TrackTest.php @@ -0,0 +1,39 @@ +make(); + + $lessons = collect([ + factory(Lesson::class)->make(), + factory(Lesson::class)->make(), + ]); + + $track->setRelation('lessons', $lessons); + + $this->assertEquals($lessons[0]->slug, $track->firstLessonSlug()); + } + + /** @test */ + public function it_counts_lessons() + { + $track = factory(Track::class)->make(); + + $lessons = collect([ + factory(Lesson::class)->make(), + factory(Lesson::class)->make(), + ]); + + $track->setRelation('lessons', $lessons); + + $this->assertEquals(2, $track->lessonCount()); + } +} From 7c5d100ecb6256f13269fabcc4f56da14962d70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 04:17:13 -0300 Subject: [PATCH 08/32] CS fix --- tests/unit/Domains/Lessons/TrackTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/Domains/Lessons/TrackTest.php b/tests/unit/Domains/Lessons/TrackTest.php index 127a5ed..9e4b507 100644 --- a/tests/unit/Domains/Lessons/TrackTest.php +++ b/tests/unit/Domains/Lessons/TrackTest.php @@ -2,9 +2,6 @@ namespace Codecasts\Domains\Lessons; -use Codecasts\Domains\Lessons\Lesson; -use Codecasts\Domains\Lessons\Track; - class TrackTest extends \TestCase { /** @test */ From 4398c0f001476020ea899984182de795e6e236e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Guimar=C3=A3es?= Date: Sat, 1 Oct 2016 04:22:52 -0300 Subject: [PATCH 09/32] Simplify track test --- tests/unit/Domains/Lessons/TrackTest.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/unit/Domains/Lessons/TrackTest.php b/tests/unit/Domains/Lessons/TrackTest.php index 9e4b507..47c7dc3 100644 --- a/tests/unit/Domains/Lessons/TrackTest.php +++ b/tests/unit/Domains/Lessons/TrackTest.php @@ -9,10 +9,7 @@ public function it_gets_the_first_lesson_slug() { $track = factory(Track::class)->make(); - $lessons = collect([ - factory(Lesson::class)->make(), - factory(Lesson::class)->make(), - ]); + $lessons = factory(Lesson::class, 2)->make(); $track->setRelation('lessons', $lessons); @@ -24,10 +21,7 @@ public function it_counts_lessons() { $track = factory(Track::class)->make(); - $lessons = collect([ - factory(Lesson::class)->make(), - factory(Lesson::class)->make(), - ]); + $lessons = factory(Lesson::class, 2)->make(); $track->setRelation('lessons', $lessons); From 211969b76b3117c1af51f839762aa7508cd0a6b0 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 04:51:08 -0300 Subject: [PATCH 10/32] trying docker tag name fix for PRs --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0158120..23126c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,18 +8,22 @@ sudo: required services: - docker +# cusomize Travis Branch to avoid invalid Docker tags +before_install: + - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z + # build this code into a docker image install: - - docker build -t $DOCKER_REPO:$TRAVIS_BRANCH . + - docker build -t $DOCKER_REPO:$DOCKER_TAG . # run unit tests script: - - docker run -it -e TRAVIS_COMMIT=$TRAVIS_COMMIT -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER -e CODECOV_TOKEN=$CODECOV_TOKEN $DOCKER_REPO:$TRAVIS_BRANCH bash .test.sh + - docker run -it -e TRAVIS_COMMIT=$TRAVIS_COMMIT -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER -e CODECOV_TOKEN=$CODECOV_TOKEN $DOCKER_REPO:$DOCKER_TAG bash .test.sh # if tests passes, push the docker image after_success: - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - docker push $DOCKER_REPO:$TRAVIS_BRANCH + - docker push $DOCKER_REPO:$DOCKER_TAG # notify slack about it notifications: From 206d48317bbf90634010bd22ce3d4e65a41b06b5 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 04:52:28 -0300 Subject: [PATCH 11/32] closing ) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 23126c8..d0885ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ services: # cusomize Travis Branch to avoid invalid Docker tags before_install: - - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z + - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) # build this code into a docker image install: From bc202dadb43188774599d906d0daea3032d13211 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:00:27 -0300 Subject: [PATCH 12/32] some verbosity for debug --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0885ed..03267b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,10 @@ services: # cusomize Travis Branch to avoid invalid Docker tags before_install: + - echo $TRAVIS_BRANCH - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) - + - echo $DOCKER_TAG + # build this code into a docker image install: - docker build -t $DOCKER_REPO:$DOCKER_TAG . From 353524636977d0a06ea3ee484deab759fe984319 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:12:03 -0300 Subject: [PATCH 13/32] testing if build is inside pull request --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03267b0..4bd4e3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,9 @@ services: # cusomize Travis Branch to avoid invalid Docker tags before_install: - - echo $TRAVIS_BRANCH + - DOCKER_REPO=codecasts/codecasts - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) - - echo $DOCKER_TAG - + # build this code into a docker image install: - docker build -t $DOCKER_REPO:$DOCKER_TAG . @@ -24,8 +23,8 @@ script: # if tests passes, push the docker image after_success: - - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - docker push $DOCKER_REPO:$DOCKER_TAG + - [ TRAVIS_PULL_REQUEST == false ] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" + - [ TRAVIS_PULL_REQUEST == false ] && docker push $DOCKER_REPO:$DOCKER_TAG # notify slack about it notifications: From 982befa848d6ec97d586365f49cb8ab431042db6 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:15:14 -0300 Subject: [PATCH 14/32] failing sintax --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4bd4e3c..542789c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ services: # cusomize Travis Branch to avoid invalid Docker tags before_install: - - DOCKER_REPO=codecasts/codecasts + - DOCKER_REPO="codecasts/codecasts" - DOCKER_TAG=$(echo "$TRAVIS_BRANCH" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) # build this code into a docker image From 6b55226454f5430e371b291c6ee015da9724aa65 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:19:49 -0300 Subject: [PATCH 15/32] it would never work, stupid me --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 542789c..d40de2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ script: # if tests passes, push the docker image after_success: - - [ TRAVIS_PULL_REQUEST == false ] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - [ TRAVIS_PULL_REQUEST == false ] && docker push $DOCKER_REPO:$DOCKER_TAG + - [ $TRAVIS_PULL_REQUEST == false ] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" + - [ $TRAVIS_PULL_REQUEST == false ] && docker push $DOCKER_REPO:$DOCKER_TAG # notify slack about it notifications: From 65cbc6221f9e9daf9739d90026eb060aabf61eab Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:22:01 -0300 Subject: [PATCH 16/32] test command instead of bash syntax --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d40de2a..7e710b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ script: # if tests passes, push the docker image after_success: - - [ $TRAVIS_PULL_REQUEST == false ] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - [ $TRAVIS_PULL_REQUEST == false ] && docker push $DOCKER_REPO:$DOCKER_TAG + - test $TRAVIS_PULL_REQUEST == false && docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" + - test $TRAVIS_PULL_REQUEST == false && docker push $DOCKER_REPO:$DOCKER_TAG # notify slack about it notifications: From 035ebc85f3a6f5e725047beb262d7681ba530ff8 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:34:26 -0300 Subject: [PATCH 17/32] Only send reports to codecov if not in a pull request --- .test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.test.sh b/.test.sh index 350426a..3386d5f 100644 --- a/.test.sh +++ b/.test.sh @@ -7,4 +7,4 @@ set -e phpdbg -qrr ./vendor/bin/phpunit --colors=never --coverage-text # Send Coverage Reports -bash <(curl -s https://codecov.io/bash) -f coverage.xml -C$TRAVIS_COMMIT -B$TRAVIS_BRANCH -b$TRAVIS_BUILD_NUMBER -t$CODECOV_TOKEN \ No newline at end of file +test $TRAVIS_PULL_REQUEST == false && bash <(curl -s https://codecov.io/bash) -f coverage.xml -C$TRAVIS_COMMIT -B$TRAVIS_BRANCH -b$TRAVIS_BUILD_NUMBER -t$CODECOV_TOKEN From e7a5ad413f562970352df61a99d25c7f58bb6966 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:39:45 -0300 Subject: [PATCH 18/32] correct if statment --- .test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.test.sh b/.test.sh index 3386d5f..33938fa 100644 --- a/.test.sh +++ b/.test.sh @@ -7,4 +7,6 @@ set -e phpdbg -qrr ./vendor/bin/phpunit --colors=never --coverage-text # Send Coverage Reports -test $TRAVIS_PULL_REQUEST == false && bash <(curl -s https://codecov.io/bash) -f coverage.xml -C$TRAVIS_COMMIT -B$TRAVIS_BRANCH -b$TRAVIS_BUILD_NUMBER -t$CODECOV_TOKEN +if [ $TRAVIS_PULL_REQUEST == false ]; then + bash <(curl -s https://codecov.io/bash) -f coverage.xml -C$TRAVIS_COMMIT -B$TRAVIS_BRANCH -b$TRAVIS_BUILD_NUMBER -t$CODECOV_TOKEN +fi From 473553d96368bff2dbaa41f494de405d24c3942a Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 05:44:48 -0300 Subject: [PATCH 19/32] increase version number --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index 3554c33..4a36342 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.0-beta-2 +3.0.0 From a210ff90deef33a8798064b7df6381283b147962 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 08:48:47 +0000 Subject: [PATCH 20/32] Applied fixes from StyleCI --- app/Domains/Lessons/Database/Factories/TrackFactory.php | 6 +++--- app/Domains/Lessons/Providers/DomainServiceProvider.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Domains/Lessons/Database/Factories/TrackFactory.php b/app/Domains/Lessons/Database/Factories/TrackFactory.php index c059eaa..ae89777 100644 --- a/app/Domains/Lessons/Database/Factories/TrackFactory.php +++ b/app/Domains/Lessons/Database/Factories/TrackFactory.php @@ -17,10 +17,10 @@ public function fields() $title = $this->faker->sentence(4); return [ - 'slug' => str_slug($title), - 'title' => $title, + 'slug' => str_slug($title), + 'title' => $title, 'description' => $this->faker->sentence(10), - 'visible' => $this->faker->boolean(50), + 'visible' => $this->faker->boolean(50), ]; } } diff --git a/app/Domains/Lessons/Providers/DomainServiceProvider.php b/app/Domains/Lessons/Providers/DomainServiceProvider.php index 30f75a7..a191fb7 100644 --- a/app/Domains/Lessons/Providers/DomainServiceProvider.php +++ b/app/Domains/Lessons/Providers/DomainServiceProvider.php @@ -29,7 +29,7 @@ class DomainServiceProvider extends ServiceProvider protected $bindings = [ LessonRepositoryContract::class => LessonRepository::class, - TrackRepositoryContract::class => TrackRepository::class, + TrackRepositoryContract::class => TrackRepository::class, ]; protected $subProviders = [ From c51668017a70d097baae56a4ba0f8edc2da568d5 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Sat, 1 Oct 2016 19:57:19 -0300 Subject: [PATCH 21/32] configure html coverage report --- phpunit.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml b/phpunit.xml index 7bd8869..d6e0d76 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,5 +23,6 @@ + From a48b7437c646f68efa930cc10f79585baabfeb6e Mon Sep 17 00:00:00 2001 From: Michal Zuber Date: Sun, 2 Oct 2016 05:31:31 +0200 Subject: [PATCH 22/32] Typo fix --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 84e44f5..27f350a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -# v2 sintax +# v2 syntax version: '2' # Named volumes From 95009d3f6b920dffc4982fca1abfd5f677d0ffcb Mon Sep 17 00:00:00 2001 From: Felipe Fontana Date: Mon, 3 Oct 2016 08:55:32 -0400 Subject: [PATCH 23/32] validation pt_BR --- resources/lang/pt_BR/validation.php | 120 ++++++++++++++-------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/resources/lang/pt_BR/validation.php b/resources/lang/pt_BR/validation.php index 72bb9aa..d20ad30 100644 --- a/resources/lang/pt_BR/validation.php +++ b/resources/lang/pt_BR/validation.php @@ -13,74 +13,74 @@ | */ - 'accepted' => 'O campo :attribute precisa ser aceito.', - 'active_url' => 'O campo :attribute precisa ser uma URL válida.', - 'after' => 'O campo :attribute precisa ser uma data após :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', + 'accepted' => ' :attribute precisa ser aceito.', + 'active_url' => ' :attribute precisa ser uma URL válida.', + 'after' => ' :attribute precisa ser uma data após :date.', + 'alpha' => ' :attribute só pode conter apenas letras.', + 'alpha_dash' => ' :attribute só pode conter letras, números e traços', + 'alpha_num' => ' :attribute só pode conter letras e números', + 'array' => ' :attribute deve ser um array.', + 'before' => ' :attribute deve ser uma data anterior a :date.', 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', + 'numeric' => ' :attribute deve estar entre :min e :max', + 'file' => ' :attribute deve estar entre :min e :max kilobytes.', + 'string' => ' :attribute deve estar entre :min e :max caracteres.', + 'array' => ' :attribute deve ter entre :min e :max itens.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field is required.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', + 'boolean' => ' :attribute campo deve ser verdadeiro ou falso.', + 'confirmed' => ' :attribute confirmação não corresponde.', + 'date' => ' :attribute não é uma data válida.', + 'date_format' => ' :attribute não coincide com o formato :format.', + 'different' => ' :attribute e :other devem ser diferentes.', + 'digits' => ' :attribute deve ter :digits dígitos.', + 'digits_between' => ' :attribute deve ter entre :min e :max dígitos.', + 'dimensions' => ' :attribute tem dimensões inválidas de imagem.', + 'distinct' => ' :attribute tem um valor duplicado.', + 'email' => ' :attribute deve ser um endereço de e-mail válido.', + 'exists' => ' :attribute selecionado é inválido.', + 'file' => ' :attribute deve ser um arquivo', + 'filled' => ' :attribute é um campo obrigatório', + 'image' => ' :attribute deve ser uma imagem.', + 'in' => ' :attribute selecionado é inválido', + 'in_array' => ' :attribute não existe em :other.', + 'integer' => ' :attribute deve ser um inteiro.', + 'ip' => ' :attribute deve ser um endereço IP válido.', + 'json' => ' :attribute deve ser um JSON válido.', 'max' => [ - 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', + 'numeric' => ' :attribute não deve ser maior que :max.', + 'file' => ' :attribute não deve ter mais que :max kilobytes.', + 'string' => ' :attribute não deve ter mais que :max caracteres.', + 'array' => ' :attribute não pode ter mais que :max itens.', ], - 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimes' => ' :attribute deve ser um arquivo do tipo: :values.', 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', + 'numeric' => ' :attribute deve ser no mínimo :min.', + 'file' => ' :attribute deve ter no mínimo :min kilobytes.', + 'string' => ' :attribute deve ter no mínimo :min caracteres.', + 'array' => ' :attribute deve ter no mínimo :min itens.', ], - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', + 'not_in' => ' :attribute selecionado é inválido.', + 'numeric' => ' O campo :attribute deve ser um número.', + 'present' => ' O campo :attribute deve estar presente.', + 'regex' => ' O formato de :attribute é inválido.', + 'required' => ' O campo :attribute é obrigatório.', + 'required_if' => ' O campo :attribute é obrigaório quando :other é :value.', + 'required_unless' => ' O campo :attribute é obrigatório a menos que :other está em :values.', + 'required_with' => ' O campo :attribute é obrigatório quando :values está presente.', + 'required_with_all' => ' O campo :attribute é obrigatório quando :values estão presentes.', + 'required_without' => ' O campo :attribute é obrigatório quando :values não está presente.', + 'required_without_all' => ' O campo :attribute é obrigatório quando nenhum destes estão presentes: :values.', + 'same' => ' :attribute e :other devem ser iguais.', 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', + 'numeric' => ' :attribute deve ser :size.', + 'file' => ' :attribute deve ter :size kilobytes.', + 'string' => ' :attribute deve ter :size caracteres.', + 'array' => ' :attribute deve conter :size itens.', ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'url' => 'The :attribute format is invalid.', + 'string' => ' :attribute deve ser uma string', + 'timezone' => ' :attribute deve ser uma timezone válida.', + 'unique' => ' :attribute já está em uso.', + 'url' => ' O formato de :attribute é inválido.', /* |-------------------------------------------------------------------------- From 43e6533208e34bb0afcca84fa655067f8927eba8 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Tue, 11 Oct 2016 21:47:04 -0300 Subject: [PATCH 24/32] bump version --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index 4a36342..cb2b00e 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.0.0 +3.0.1 From edf7d0101e1a68b4bbd39ea0b7a51aa71f431f31 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Tue, 11 Oct 2016 21:47:56 -0300 Subject: [PATCH 25/32] fixing wrong merge from upstream --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index cb2b00e..b502146 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.0.1 +3.0.2 From 3c5337699045b93fa39fbb7a92fcbd028be74a80 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Wed, 12 Oct 2016 17:07:15 -0300 Subject: [PATCH 26/32] disabling crisp --- app/Units/Core/Resources/Views/layout.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Units/Core/Resources/Views/layout.blade.php b/app/Units/Core/Resources/Views/layout.blade.php index ddeb345..7c26896 100644 --- a/app/Units/Core/Resources/Views/layout.blade.php +++ b/app/Units/Core/Resources/Views/layout.blade.php @@ -116,6 +116,7 @@ @include('core::_sentry') @include('core::_analytics') -@include('core::_crisp') +{{-- disabling crisp for now --}} +{{-- @include('core::_crisp') --}} From 3ef1f3fc919fe7d17defff8dd8410cdc05f2b306 Mon Sep 17 00:00:00 2001 From: Diego Hernandes Date: Wed, 12 Oct 2016 17:08:08 -0300 Subject: [PATCH 27/32] bump version --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index b502146..75a22a2 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.0.2 +3.0.3 From 60b0e33941b749a798804f185e065af4c9044673 Mon Sep 17 00:00:00 2001 From: leonardo Date: Wed, 19 Oct 2016 18:12:59 -0200 Subject: [PATCH 28/32] Rename Track occurences to Series issue #5 --- ...rackRepository.php => SerieRepository.php} | 8 +- .../{TrackFactory.php => SerieFactory.php} | 8 +- .../Migrations/CreateLessonsTable.php | 2 +- ...eTracksTable.php => CreateSeriesTable.php} | 6 +- app/Domains/Lessons/Lesson.php | 6 +- ...{TrackPresenter.php => SeriePresenter.php} | 2 +- .../Providers/DomainServiceProvider.php | 14 +-- ...rackRepository.php => SerieRepository.php} | 20 ++-- .../Lessons/Resources/Lang/en/lesson.php | 6 +- .../Lessons/Resources/Lang/pt_BR/lesson.php | 6 +- app/Domains/Lessons/{Track.php => Serie.php} | 10 +- .../Lessons/Transformers/SerieTransformer.php | 16 +++ .../Lessons/Transformers/TrackTransformer.php | 16 --- app/Support/ElasticSearch/Indexer.php | 2 +- app/Support/Statistics/Sources/Lessons.php | 8 +- app/Units/Core/Resources/Lang/pt_BR/menu.php | 2 +- .../Resources/Views/_header/_menu.blade.php | 4 +- .../Http/Controllers/LessonController.php | 4 +- .../Http/Controllers/SerieController.php | 64 +++++++++++ .../Http/Controllers/TrackController.php | 64 ----------- .../Resources/Views/lesson/box.blade.php | 4 +- .../Resources/Views/serie/box.blade.php | 12 +++ .../Views/{track => serie}/index.blade.php | 10 +- .../{track => serie}/lesson_box.blade.php | 4 +- .../Views/{track => serie}/show.blade.php | 8 +- .../Lessons/Resources/Views/show.blade.php | 24 ++--- .../Resources/Views/track/box.blade.php | 12 --- app/Units/Lessons/Routes/Web.php | 10 +- .../Http/Controllers/PagesController.php | 2 +- .../Resources/Views/statistics.blade.php | 2 +- .../Http/Controllers/DashboardController.php | 2 +- .../Controllers/Lesson/LessonController.php | 14 +-- .../Controllers/Lesson/SerieController.php | 101 ++++++++++++++++++ .../Controllers/Lesson/TrackController.php | 101 ------------------ .../Http/Requests/Lesson/NewTrackRequest.php | 2 +- .../Requests/Lesson/UpdateTrackRequest.php | 2 +- .../Panel/Resources/Views/dashboard.blade.php | 2 +- .../Panel/Resources/Views/layout.blade.php | 6 +- .../Resources/Views/lesson/form.blade.php | 8 +- .../Resources/Views/lesson/index.blade.php | 4 +- .../lesson/{track => serie}/create.blade.php | 6 +- .../lesson/{track => serie}/edit.blade.php | 6 +- .../lesson/{track => serie}/form.blade.php | 2 +- .../lesson/{track => serie}/index.blade.php | 18 ++-- app/Units/Panel/Routes/Web.php | 2 +- .../Lessons/{TrackTest.php => SerieTest.php} | 12 +-- 46 files changed, 322 insertions(+), 322 deletions(-) rename app/Domains/Lessons/Contracts/{TrackRepository.php => SerieRepository.php} (75%) rename app/Domains/Lessons/Database/Factories/{TrackFactory.php => SerieFactory.php} (75%) rename app/Domains/Lessons/Database/Migrations/{CreateTracksTable.php => CreateSeriesTable.php} (81%) rename app/Domains/Lessons/Presenters/{TrackPresenter.php => SeriePresenter.php} (91%) rename app/Domains/Lessons/Repositories/{TrackRepository.php => SerieRepository.php} (64%) rename app/Domains/Lessons/{Track.php => Serie.php} (80%) create mode 100644 app/Domains/Lessons/Transformers/SerieTransformer.php delete mode 100644 app/Domains/Lessons/Transformers/TrackTransformer.php create mode 100644 app/Units/Lessons/Http/Controllers/SerieController.php delete mode 100644 app/Units/Lessons/Http/Controllers/TrackController.php create mode 100644 app/Units/Lessons/Resources/Views/serie/box.blade.php rename app/Units/Lessons/Resources/Views/{track => serie}/index.blade.php (72%) rename app/Units/Lessons/Resources/Views/{track => serie}/lesson_box.blade.php (86%) rename app/Units/Lessons/Resources/Views/{track => serie}/show.blade.php (90%) delete mode 100644 app/Units/Lessons/Resources/Views/track/box.blade.php create mode 100644 app/Units/Panel/Http/Controllers/Lesson/SerieController.php delete mode 100644 app/Units/Panel/Http/Controllers/Lesson/TrackController.php rename app/Units/Panel/Resources/Views/lesson/{track => serie}/create.blade.php (74%) rename app/Units/Panel/Resources/Views/lesson/{track => serie}/edit.blade.php (72%) rename app/Units/Panel/Resources/Views/lesson/{track => serie}/form.blade.php (93%) rename app/Units/Panel/Resources/Views/lesson/{track => serie}/index.blade.php (66%) rename tests/unit/Domains/Lessons/{TrackTest.php => SerieTest.php} (53%) diff --git a/app/Domains/Lessons/Contracts/TrackRepository.php b/app/Domains/Lessons/Contracts/SerieRepository.php similarity index 75% rename from app/Domains/Lessons/Contracts/TrackRepository.php rename to app/Domains/Lessons/Contracts/SerieRepository.php index 500b213..fe9b857 100644 --- a/app/Domains/Lessons/Contracts/TrackRepository.php +++ b/app/Domains/Lessons/Contracts/SerieRepository.php @@ -5,10 +5,10 @@ use Artesaos\Warehouse\Contracts\BaseRepository; use Artesaos\Warehouse\Contracts\Segregated\CrudRepository; -interface TrackRepository extends CrudRepository, BaseRepository +interface SerieRepository extends CrudRepository, BaseRepository { /** - * Get all visible tracks. + * Get all visible series. * * @param int $take * @param bool $paginate @@ -18,12 +18,12 @@ interface TrackRepository extends CrudRepository, BaseRepository public function getVisible($take = 9, $paginate = true); /** - * Find a track by it's slug. + * Find a serie by it's slug. * * @param string $slug * @param bool $fail * - * @return Track|null + * @return Serie|null */ public function findBySlug($slug, $fail = false); } diff --git a/app/Domains/Lessons/Database/Factories/TrackFactory.php b/app/Domains/Lessons/Database/Factories/SerieFactory.php similarity index 75% rename from app/Domains/Lessons/Database/Factories/TrackFactory.php rename to app/Domains/Lessons/Database/Factories/SerieFactory.php index ae89777..39f3ff3 100644 --- a/app/Domains/Lessons/Database/Factories/TrackFactory.php +++ b/app/Domains/Lessons/Database/Factories/SerieFactory.php @@ -2,15 +2,15 @@ namespace Codecasts\Domains\Lessons\Database\Factories; -use Codecasts\Domains\Lessons\Track; +use Codecasts\Domains\Lessons\Serie; use Codecasts\Support\Domain\ModelFactory; /** - * Class TrackFactory. + * Class SerieFactory. */ -class TrackFactory extends ModelFactory +class SerieFactory extends ModelFactory { - protected $model = Track::class; + protected $model = Serie::class; public function fields() { diff --git a/app/Domains/Lessons/Database/Migrations/CreateLessonsTable.php b/app/Domains/Lessons/Database/Migrations/CreateLessonsTable.php index 5102944..c1e83d6 100644 --- a/app/Domains/Lessons/Database/Migrations/CreateLessonsTable.php +++ b/app/Domains/Lessons/Database/Migrations/CreateLessonsTable.php @@ -24,7 +24,7 @@ public function up() $table->boolean('published')->default(false); $table->boolean('visible')->default(false); $table->boolean('paid')->default(true); - $table->integer('track_id', false, true)->nullable()->index(); + $table->integer('serie_id', false, true)->nullable()->index(); $table->timestamp('published_at')->nullable(); $table->unsignedInteger('times_downloaded')->default(0); $table->unsignedInteger('times_played')->default(0); diff --git a/app/Domains/Lessons/Database/Migrations/CreateTracksTable.php b/app/Domains/Lessons/Database/Migrations/CreateSeriesTable.php similarity index 81% rename from app/Domains/Lessons/Database/Migrations/CreateTracksTable.php rename to app/Domains/Lessons/Database/Migrations/CreateSeriesTable.php index 57268f1..8a41a17 100644 --- a/app/Domains/Lessons/Database/Migrations/CreateTracksTable.php +++ b/app/Domains/Lessons/Database/Migrations/CreateSeriesTable.php @@ -5,14 +5,14 @@ use Codecasts\Support\Domain\Migration; use Illuminate\Database\Schema\Blueprint; -class CreateTracksTable extends Migration +class CreateSeriesTable extends Migration { /** * Run the migrations. */ public function up() { - $this->schema->create('tracks', function (Blueprint $table) { + $this->schema->create('series', function (Blueprint $table) { $table->increments('id'); $table->string('slug')->unique()->index(); $table->string('title'); @@ -28,6 +28,6 @@ public function up() */ public function down() { - $this->schema->drop('tracks'); + $this->schema->drop('series'); } } diff --git a/app/Domains/Lessons/Lesson.php b/app/Domains/Lessons/Lesson.php index c47fa41..8a6ed3c 100644 --- a/app/Domains/Lessons/Lesson.php +++ b/app/Domains/Lessons/Lesson.php @@ -34,7 +34,7 @@ class Lesson extends Model 'published', 'visible', 'paid', - 'track_id', + 'serie_id', 'published_at', ]; @@ -43,9 +43,9 @@ class Lesson extends Model 'published_at', ]; - public function track() + public function serie() { - return $this->belongsTo(Track::class, 'track_id'); + return $this->belongsTo(Serie::class, 'serie_id'); } public function tags() diff --git a/app/Domains/Lessons/Presenters/TrackPresenter.php b/app/Domains/Lessons/Presenters/SeriePresenter.php similarity index 91% rename from app/Domains/Lessons/Presenters/TrackPresenter.php rename to app/Domains/Lessons/Presenters/SeriePresenter.php index 0909cd4..4e676ce 100644 --- a/app/Domains/Lessons/Presenters/TrackPresenter.php +++ b/app/Domains/Lessons/Presenters/SeriePresenter.php @@ -5,7 +5,7 @@ use Codecasts\Support\Helpers\TimeHelper; use Codecasts\Support\ViewPresenter\Presenter; -class TrackPresenter extends Presenter +class SeriePresenter extends Presenter { public function length() { diff --git a/app/Domains/Lessons/Providers/DomainServiceProvider.php b/app/Domains/Lessons/Providers/DomainServiceProvider.php index a191fb7..3f042a5 100644 --- a/app/Domains/Lessons/Providers/DomainServiceProvider.php +++ b/app/Domains/Lessons/Providers/DomainServiceProvider.php @@ -3,15 +3,15 @@ namespace Codecasts\Domains\Lessons\Providers; use Codecasts\Domains\Lessons\Contracts\LessonRepository as LessonRepositoryContract; -use Codecasts\Domains\Lessons\Contracts\TrackRepository as TrackRepositoryContract; +use Codecasts\Domains\Lessons\Contracts\SerieRepository as SerieRepositoryContract; use Codecasts\Domains\Lessons\Database\Factories\LessonFactory; -use Codecasts\Domains\Lessons\Database\Factories\TrackFactory; +use Codecasts\Domains\Lessons\Database\Factories\SerieFactory; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonLogsTable; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonsTable; use Codecasts\Domains\Lessons\Database\Migrations\CreateLessonsTagsTable; -use Codecasts\Domains\Lessons\Database\Migrations\CreateTracksTable; +use Codecasts\Domains\Lessons\Database\Migrations\CreateSeriesTable; use Codecasts\Domains\Lessons\Repositories\LessonRepository; -use Codecasts\Domains\Lessons\Repositories\TrackRepository; +use Codecasts\Domains\Lessons\Repositories\SerieRepository; use Codecasts\Support\Domain\ServiceProvider; class DomainServiceProvider extends ServiceProvider @@ -22,14 +22,14 @@ class DomainServiceProvider extends ServiceProvider protected $migrations = [ CreateLessonsTable::class, - CreateTracksTable::class, + CreateSeriesTable::class, CreateLessonsTagsTable::class, CreateLessonLogsTable::class, ]; protected $bindings = [ LessonRepositoryContract::class => LessonRepository::class, - TrackRepositoryContract::class => TrackRepository::class, + SerieRepositoryContract::class => SerieRepository::class, ]; protected $subProviders = [ @@ -38,6 +38,6 @@ class DomainServiceProvider extends ServiceProvider protected $factories = [ LessonFactory::class, - TrackFactory::class, + SerieFactory::class, ]; } diff --git a/app/Domains/Lessons/Repositories/TrackRepository.php b/app/Domains/Lessons/Repositories/SerieRepository.php similarity index 64% rename from app/Domains/Lessons/Repositories/TrackRepository.php rename to app/Domains/Lessons/Repositories/SerieRepository.php index 5d98ac4..0a816c8 100644 --- a/app/Domains/Lessons/Repositories/TrackRepository.php +++ b/app/Domains/Lessons/Repositories/SerieRepository.php @@ -4,17 +4,17 @@ use Artesaos\Warehouse\AbstractCrudRepository; use Artesaos\Warehouse\Traits\ImplementsFractal; -use Codecasts\Domains\Lessons\Contracts\TrackRepository as TrackRepositoryContract; -use Codecasts\Domains\Lessons\Track; -use Codecasts\Domains\Lessons\Transformers\TrackTransformer; +use Codecasts\Domains\Lessons\Contracts\SerieRepository as SerieRepositoryContract; +use Codecasts\Domains\Lessons\Serie; +use Codecasts\Domains\Lessons\Transformers\SerieTransformer; -class TrackRepository extends AbstractCrudRepository implements TrackRepositoryContract +class SerieRepository extends AbstractCrudRepository implements SerieRepositoryContract { use ImplementsFractal; - protected $modelClass = Track::class; + protected $modelClass = Serie::class; - protected $transformerClass = TrackTransformer::class; + protected $transformerClass = SerieTransformer::class; public function getAll($take = 15, $paginate = true) { @@ -27,7 +27,7 @@ public function getAll($take = 15, $paginate = true) * @param string $slug * @param bool $fail * - * @return Track|null + * @return Serie|null */ public function findBySlug($slug, $fail = false) { @@ -43,9 +43,9 @@ public function findBySlug($slug, $fail = false) public function getVisible($take = 9, $paginate = true) { $query = $this->newQuery(); - $query->leftJoin('lessons', 'lessons.track_id', '=', 'tracks.id'); - $query->select('tracks.*'); - $query->groupBy('tracks.id'); + $query->leftJoin('lessons', 'lessons.serie_id', '=', 'series.id'); + $query->select('series.*'); + $query->groupBy('series.id'); $query->orderByRaw('max(lessons.published_at) desc'); return $this->doQuery($query, $take, $paginate); diff --git a/app/Domains/Lessons/Resources/Lang/en/lesson.php b/app/Domains/Lessons/Resources/Lang/en/lesson.php index 9a01174..58cbada 100644 --- a/app/Domains/Lessons/Resources/Lang/en/lesson.php +++ b/app/Domains/Lessons/Resources/Lang/en/lesson.php @@ -13,13 +13,13 @@ 'published' => 'published', 'visible' => 'visible', 'paid' => 'paid', - 'track' => 'track', - 'track_id' => 'track', + 'serie' => 'serie', + 'serie_id' => 'serie', 'published_at' => 'published at', 'deleted_at' => 'deleted at', 'created_at' => 'created at', 'updated_at' => 'updated at', 'current' => 'current', 'lessons' => 'lessons', - 'tracks' => 'séries', + 'series' => 'séries', ]; diff --git a/app/Domains/Lessons/Resources/Lang/pt_BR/lesson.php b/app/Domains/Lessons/Resources/Lang/pt_BR/lesson.php index 05ae0cf..e14e0b5 100644 --- a/app/Domains/Lessons/Resources/Lang/pt_BR/lesson.php +++ b/app/Domains/Lessons/Resources/Lang/pt_BR/lesson.php @@ -13,13 +13,13 @@ 'published' => 'publicado', 'visible' => 'visível', 'paid' => 'pago', - 'track' => 'série', - 'track_id' => 'série', + 'serie' => 'série', + 'serie_id' => 'série', 'published_at' => 'publicado em', 'deleted_at' => 'removido em', 'created_at' => 'criado em', 'updated_at' => 'atualizado em', 'current' => 'atual', 'lessons' => 'aulas', - 'tracks' => 'séries', + 'series' => 'séries', ]; diff --git a/app/Domains/Lessons/Track.php b/app/Domains/Lessons/Serie.php similarity index 80% rename from app/Domains/Lessons/Track.php rename to app/Domains/Lessons/Serie.php index 3d99a87..0b1c445 100644 --- a/app/Domains/Lessons/Track.php +++ b/app/Domains/Lessons/Serie.php @@ -2,16 +2,16 @@ namespace Codecasts\Domains\Lessons; -use Codecasts\Domains\Lessons\Presenters\TrackPresenter; +use Codecasts\Domains\Lessons\Presenters\SeriePresenter; use Codecasts\Support\ViewPresenter\Presentable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; -class Track extends Model +class Serie extends Model { use SoftDeletes, Presentable; - protected $table = 'tracks'; + protected $table = 'series'; protected $fillable = [ 'title', @@ -24,11 +24,11 @@ class Track extends Model // 'visible' => 'boolean', //]; - protected $presenter = TrackPresenter::class; + protected $presenter = SeriePresenter::class; public function lessons() { - return $this->hasMany(Lesson::class, 'track_id'); + return $this->hasMany(Lesson::class, 'serie_id'); } public function firstLessonSlug() diff --git a/app/Domains/Lessons/Transformers/SerieTransformer.php b/app/Domains/Lessons/Transformers/SerieTransformer.php new file mode 100644 index 0000000..669c791 --- /dev/null +++ b/app/Domains/Lessons/Transformers/SerieTransformer.php @@ -0,0 +1,16 @@ + $serie->id, + ]; + } +} diff --git a/app/Domains/Lessons/Transformers/TrackTransformer.php b/app/Domains/Lessons/Transformers/TrackTransformer.php deleted file mode 100644 index 1cd91c1..0000000 --- a/app/Domains/Lessons/Transformers/TrackTransformer.php +++ /dev/null @@ -1,16 +0,0 @@ - $track->id, - ]; - } -} diff --git a/app/Support/ElasticSearch/Indexer.php b/app/Support/ElasticSearch/Indexer.php index 10f4b4f..2265cd3 100644 --- a/app/Support/ElasticSearch/Indexer.php +++ b/app/Support/ElasticSearch/Indexer.php @@ -37,7 +37,7 @@ public function index() $elastic = app('elastic'); $this->items->each(function ($item) use ($elastic) { - $item->track_title = $item->track ? $item->track->title : ''; + $item->serie_title = $item->serie ? $item->serie->title : ''; $elastic->index([ 'index' => 'codecasts', diff --git a/app/Support/Statistics/Sources/Lessons.php b/app/Support/Statistics/Sources/Lessons.php index 1365d31..91f0c9a 100644 --- a/app/Support/Statistics/Sources/Lessons.php +++ b/app/Support/Statistics/Sources/Lessons.php @@ -3,7 +3,7 @@ namespace Codecasts\Support\Statistics\Sources; use Codecasts\Domains\Lessons\Repositories\LessonRepository; -use Codecasts\Domains\Lessons\Repositories\TrackRepository; +use Codecasts\Domains\Lessons\Repositories\SerieRepository; use Codecasts\Support\Helpers\TimeHelper; class Lessons extends Source @@ -27,11 +27,11 @@ public function getCount() return $this->getLessonsCount(); } - public function getTracks() + public function getSeries() { - $trackRepository = new TrackRepository(); + $serieRepository = new SerieRepository(); - return $trackRepository->getVisible(false, false)->count(); + return $serieRepository->getVisible(false, false)->count(); } protected function getHumanPublishedTime() diff --git a/app/Units/Core/Resources/Lang/pt_BR/menu.php b/app/Units/Core/Resources/Lang/pt_BR/menu.php index bdf2edc..126fee0 100644 --- a/app/Units/Core/Resources/Lang/pt_BR/menu.php +++ b/app/Units/Core/Resources/Lang/pt_BR/menu.php @@ -2,7 +2,7 @@ return [ 'lessons' => 'aulas', - 'track' => 'séries', + 'serie' => 'séries', 'suggestions' => 'sugestões', 'discuss' => 'discutir', 'subscribe' => 'assinar', diff --git a/app/Units/Core/Resources/Views/_header/_menu.blade.php b/app/Units/Core/Resources/Views/_header/_menu.blade.php index 8722b87..ae3864f 100644 --- a/app/Units/Core/Resources/Views/_header/_menu.blade.php +++ b/app/Units/Core/Resources/Views/_header/_menu.blade.php @@ -1,11 +1,11 @@
{{ str_limit($lesson->description, 100) }}
- @if($lesson->track) -
{{ $lesson->track->title }}
+ @if($lesson->serie) +
{{ $lesson->serie->title }}
@endif