msassa

msassa

Member Since 2 Years Ago

Experience Points 49,580
Experience Level 10

420 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 493
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.

04 Mar
2 weeks ago

msassa started a new conversation Create A Distributable Widget With VueJS In Laravel Backend

I have this backend made in Laravel, and I need through an api endpoint delivery some slider widget. Something like when I call https://backend.com/api/v2/slider/2 the api respond something like:

<link href="https://backend.com/css/slider.css" rel=stylesheet>
<vue-slider title="Example Slider"></vue-slider>
<script src="https://backend.com/js/slider.js">

I found this excellent article https://itnext.io/vuidget-how-to-create-an-embeddable-vue-js-widget-with-vue-custom-element-674bdcb96b97 and I think is what I'm looking for, but is make in vue-cli and I can't figure out how to adapt that in my laravel application.

If any one have some ideas, or a better way, thanks !!!

05 Feb
1 month ago

msassa started a new conversation Scout ToSearchableArray Doesn't Get Relations When Save From Nova

I have a model, with some relations. One is a belongsTo, and I'm adding some information from this relation to the toSearchableArray to indexed in Algolia. The main model is something like this:

class Car extends Model
{
    use Searchable;

    public function toSearchableArray()
    {
        $searchableCar = array_only(
            $this->toArray(),
            ['id', 'title', 'url', 'active', 'vin', 'stock', 'bodyStyle', 'certifiedPreowned', 'color', 'diff', 'engine', 'kilometer', 'miles', 'make', 'model', 'price', 'year']
        );

        $searchableCar['import'] = $this->import->name;

        return $searchableCar;
    }

    public function import()
    {
        return $this->belongsTo(Import::class);
    }
}

And when I create a new model from Nova, I get an error saying ErrorException: Trying to get property 'name' of non-object like the relation doesn't exist yet.

I make a dump of the model in the saved event, and the import is null ?‍♂️

I fix this overwriting the method:

public function queueMakeSearchable($models)
    {
        if ($models->isEmpty()) {
            return;
        }

        $models->load('import');

        if (!config('scout.queue')) {
            return $models->first()->searchableUsing()->update($models);
        }

        dispatch((new MakeSearchable($models))
            ->onQueue($models->first()->syncWithSearchUsingQueue())
            ->onConnection($models->first()->syncWithSearchUsing()));
    }

and manually loading the relation and it works ... but doesn't feel ok

Someone has deal with this problem?

04 Dec
3 months ago

msassa left a reply on Lock Button Action

@DEVOPS92 - Can you explain how you did this, please?

23 Jul
7 months ago

msassa started a new conversation Npm Run Watch - Exports.push Is Not A Function

It is happening to me that when I run npm run watch, the first compilation works fine, and then, when it detects a change in some vue file, and compiles automatically, in the browser I get these errors:

[Vue warn]: Error in beforeCreate hook: "TypeError: exports.push is not a function"
-----------------
TypeError: exports.push is not a function

and that component no longer works. I have to stop the watch and run it again. Is impossible to work.

Any idea?

25 Jun
8 months ago
24 Jun
8 months ago

msassa started a new conversation Sending Emails Through Queue (horizon)

I have an issue sending emails through queue. Some times, is taking an old version (old text, old 'from address', everything). I already cleared the cache, restart horizon, and is radom. Any idea what can I do? Thanks

30 May
1 year ago

msassa started a new conversation Querying Related Models

I have the following problem: I need to select users who meet these conditions:

  • be active
  • belong to a particular group
  • belong to a specific category

And here are the two conditions that are giving me problems: 1 # that are within a radius of 200kms 2 # that the category is not overdue

For the 1 # each user has a related hasMany zone (Model Zone) where has lat and lng The 2 # each user has a relationship with the category, and that relationship has a start date and a duration

Today I am doing it in 2 parts, first I select all the users who fulfill the first conditions, And then I make a foreach checking the other two:

$filterSellerByCat = function ($q) use ($category)
{
    $q->where('category_id', '=', $category);
};

$sellers = User::with(['groups', 'zones', 'categories' => $filterSellerByCat])
            ->where('activated', '=', '1')
            ->whereHas('groups', function($q){
                    $q->where('id', '=', '3');
                })
            ->whereHas('categories', $filterSellerByCat)
            ->get();


foreach ($sellers as $seller) {
    if($seller->zones[0]->distance()<200 and $seller->categories[0]->pivot->created_at > Carbon::now()->subMonths($seller->categories[0]->pivot->duration)){
        # MAKE SOME STUFF
    }
}

In the Zone model, I created a distance method, which returns the distance from a given point and that zone:

public function distance()
{
    $sql = DB::raw("SELECT ((6378 * acos( cos( radians(POINT_LAT) ) * cos( radians( users_zones.lat ) ) * cos( radians( users_zones.lng) - radians(POINT_LNG) ) + sin( radians(POINT_LAT) ) * sin( radians( users_zones.lat ) ) ) ) ) AS distance FROM users_zones WHERE users_zones.id = {$this->id}");
    $distance = DB::select($sql);
    return $distance[0]->distance;
}

Obviously is not the right way because when you have 10000 users that meet the first condition, the foreach it will take too long and consume too much resources.

Someone could suggest me a better solution. I was trying to do everything in the first query ($sellers), but I have not succeeded. Thank you very much