spqa

spqa

Member Since 3 Years Ago

Experience Points
4,110
Total
Experience

890 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
38
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
4,110 XP
26 Mar
1 year ago

spqa left a reply on PHPUnit Checking Errors Incorrect In PHPStorm?

Thank you, viktorivanov. It's work

spqa started a new conversation Hidden Field In API Resource Using Conditional Attributes?

Now, I'm trying to building API Resource and I wanna hide some kind of data.

For example, I want to hide attribute 'description' only in MangaCollection. I mean I just only wanna hide this attribute in Collection, not Resource. Because Collection be called from Resource but I don't want to hide it in Resource.

MangaResource.php

class MangaResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'status' => $this->status,
            'view' => $this->name,
            'slug' => $this->slug,
            'avatar' => $this->avatar,
            'description' => $this->description,
            'created_at' => (string) $this->created_at,
            'updated_at' => (string) $this->updated_at,
            'authors' => AuthorResource::collection($this->authors),
            'categories' => CategoryResource::collection($this->categories)
        ];
    }
}

MangaCollection.php

class MangaCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  Request $request
     * @return AnonymousResourceCollection
     */
    public function toArray($request)
    {
        return MangaResource::collection($this->collection);
    }
}

MangaController.php

class MangaController extends Controller
{
    /**
     * Display a collection of the mangas.
     *
     * @return MangaCollection
     */
    public function index()
    {
        return new MangaCollection(Manga::paginate(10));
    }

    /**
     * Display the specified manga.
     *
     * @param Manga $manga
     * @return MangaResource
     */
    public function show(Manga $manga)
    {
        return new MangaResource($manga);
    }
}

Could consider using Conditional Attributes to solve this problem, anyone can help me, please ?

08 Mar
1 year ago

spqa started a new conversation PHPUnit Checking Errors Incorrect In PHPStorm?

I'm trying to follow the topic Build the forum with TDD approach. You know that PHPUnit is very important to display errors when we running a TestCase.

The problem is when I'm running test by command line is work but when I'm trying to run the test with PHPStorm, it works incorrectly.

This code:

    /** @test */
    public function an_authenticated_user_only_favorite_reply_once_time()
    {
        $this->signIn();

        $reply = create(Reply::class);

        // Like a reply multiple time (store favorites)
        $this->post('replies/' . $reply->id . '/favorites');
        $this->post('replies/' . $reply->id . '/favorites');

        $this->assertCount(1, $reply->favorites);
    }

and PHPStorm message show:

C:\laragon\bin\php\php-7.1.12-Win32-VC14-x64\php.exe E:/Coding/PG/ATeam/forum/vendor/phpunit/phpunit/phpunit --no-configuration --filter "/::an_authenticated_user_only_favorite_reply_once_time( .*)?$/" Tests\Feature\FavoritesTest E:\Coding\PG\ATeam\forum\tests\Feature\FavoritesTest.php --teamcity
PHPUnit 7.0.2 by Sebastian Bergmann and contributors.


Failed asserting that actual size 0 matches expected size 1.
 E:\Coding\PG\ATeam\forum\tests\Feature\FavoritesTest.php:44

Anyone can tell me why?