msassa

msassa

Member Since 2 Years Ago

Experience Points 50,840
Experience Level 11

4,160 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 505
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.

08 May
2 months ago

msassa left a reply on Chaining Jobs Doesn't Work For Me

I found the solution, you need to be explicit on the connection and queue

    [
        (new CleanTenantCache(config('tenant.slug')))->onConnection('connection')->onQueue('queue'),
    ]
)->dispatch($request->ids, config('tenant.slug'));```
07 May
2 months ago

msassa started a new conversation Chaining Jobs Doesn't Work For Me

Hi everyone. I have this problem: i'm trying to chain some jobs, but doesn't seem to works or I'm not doing it the right way.

I have two jobs, and I call it this way:

        MakeReplacements::withChain(
            [
                new CleanTenantCache(config('tenant.slug')),
            ]
        )->dispatch($request->ids, config('tenant.slug'));

I try this way too:

        MakeReplacements::dispatch($request->ids, config('tenant.slug'))->chain(
            [
                new CleanTenantCache(config('tenant.slug')),
            ]
        );

And only execute the first job MakeReplacements:

[2019-05-07 22:30:06][102] Processing: App\Jobs\MakeReplacements [2019-05-07 22:30:07][102] Processed: App\Jobs\MakeReplacements

Any idea, please.

04 Mar
4 months 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
5 months 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
7 months ago

msassa left a reply on Lock Button Action

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

23 Jul
1 year 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
1 year ago
24 Jun
1 year 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
2 years 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