rzvme

rzvme

Member Since 2 Years Ago

Experience Points 18,780
Experience Level 4

1,220 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 186
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

29 May
1 year ago

rzvme left a reply on Get All Collections With BelongsToMany Relation

To be more cleared, the "name" column comes from roles collection. For example:

App\User::find(1)->roles()->orderBy('name')->get()->pluck('name');

returns:

=> Illuminate\Support\Collection {#2386
     all: [
       "admin",
       "basicUser",
       "moderator",
     ],
   }

which is correct. In the same way I need to get all the users with associated roles name not just a particular one.

rzvme left a reply on Get All Collections With BelongsToMany Relation

I've tried both

App\User->roles()->orderBy('name')->get()->pluck('name');

PHP Parse error: Syntax error, unexpected T_OBJECT_OPERATOR on line 1

App\User::roles()->orderBy('name')->get()->pluck('name');

PHP Deprecated: Non-static method App/GroupDestination::destinations() should not be called statically in Psy Shell code on line 1

rzvme started a new conversation Get All Collections With BelongsToMany Relation

Hello,

I'm trying to get all collections with associate relations.

For example this example works fine

App\User::find(1)->roles()->orderBy('name')->get()->pluck('name');

But if I try to get all the users from User collection with their associated roles this doesn't work.

App\User::get()->roles()->orderBy('name')->get()->pluck('name'); 

Errore: BadMethodCallException with message 'Method Illuminate/Database/Eloquent/Collection::roles does not exist.

20 Apr
1 year ago

rzvme started a new conversation Use The Previous Factory Generated Value

Dear community,

I have the following dummy example in which I need to generate fake database data. The error I receive is that $loadData['tagName'] actually is the closure function not the value returned by the function.

Do you know how can I use the previous generate value, --tagName--, in the calculation of --tag_replace--?

$factory->define(App\LoadData::class, function (Faker $faker) {
    return [
        'tag_id'=> App\Tag::all()->random()->id,
        'tagName'=>function (array $loadData) {
            return App\Tag::find($load['tag_id'])->name;
        },
        'tag_replace'=> function (array $loadData) {
            $q = $loadData['tagName']."REGEXP expression";
            return App\slug::whereRaw(1)->orderByRaw($q)->first()->tag_id;
        },
    ];
});
16 Aug
1 year ago

rzvme left a reply on Seeding Foreign Key Records

@martinbean But this do not guarantee that every author has at least one article or a book.

15 Aug
1 year ago

rzvme started a new conversation Seeding Foreign Key Records

I have an Author,Article, Book and Genre factory models with the following relations: Author->hasMany(Article) and Author->hasMany(Book). I'm trying to seed all the tables at a time but I'm not sure if the efficient way is this:


        factory('App\Author',5)
        ->create()
        ->each(function($author) {
            factory('App\Article',2)->create(['author_id'=>$author->id]);
            foreach (range(1,5) as $indexBook) {
                $genre= App\Genre::inRandomOrder()->first();
                factory('App\Book')->create([
                    'author_id'=>$author->id,
                    'genre_id'=>$genre->id,
                    'type'=>$genre->name
                ]);
            }
        });

Of course I can seed the tables one at a time and for the foreign keys I can use something like:


'author_id' => $faker->randomElement(App\Author::pluck('id')->toArray())

I think is something related with saveMany() method but I can't figure how.