wwweston

wwweston

Member Since 6 Months Ago

Experience Points 80
Experience Level 1

4,920 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 0
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.

11 Dec
4 months ago

wwweston left a reply on ResourceCollection Throwing An 'Undefined Property ($map) Error'

I can't find a DELETE QUESTION action... Sorry, but I found the problem. I was attempting to use the ResourceCollection::collection($collection) (like with a singular resource) static call, when it should have been new ResourceCollection($collection).

Sorry- if anyone knows how to remove your own questions, I'd like to delete this.

wwweston started a new conversation ResourceCollection Throwing An 'Undefined Property ($map) Error'

I'm pretty new to the Resources stuff... I'm getting an Undefined property: Illuminate\Database\Query\Builder::$map error thrown when I try to implement this collection resource...

I read: https://laracasts.com/discuss/channels/eloquent/undefined-property-illuminatedatabasequerybuildermap

But this doesn't seem to apply to me, as I can confirm that $this->leads is in fact a collection.

class FormResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  33
     * @return array
     */
    public function toArray($request)
    {
        return [
            'relationships' => [
                'owner' => new User($this->owner),
                'leads' => Leads::collection($this->leads),
                'experiments' => Experiments::collection($this->experiments),
            ],
            'attributes' => parent::toArray($request)
        ];
    }

}
...```

```...
class Leads extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return parent::toArray($request);
    }
...```

I'm sure I'm doing something wrong, just can't figure what it is. I seem to be following the specs in the docs: https://laravel.com/docs/5.7/eloquent-resources
23 Oct
6 months ago

wwweston left a reply on Prevent SQL Injection In DB:raw

Hey @pascal83 - I just joined the site recently. I know this is an old post. But I thought I'd help you re-write that DB::raw query using DB::select (with bindings). So, similar to using something like $modelQueryBuilder->where($x, $y)->setBindings((array) $dataBindings)->get();. Your query would look a little like this;


$sql_statement =
"SELECT
       Users.name,
       profiles.cities,
       profiles.firstlanguage,
       ATAN2(
            SQRT(
                POW(
                    COS(
                        RADIANS(:session_lat))
                        * SIN(RADIANS(Y(gm_coor) - :session_lng)), 2)
                        + POW(COS(RADIANS(X(gm_coor)))
                        * SIN(RADIANS(:session_lat))
                        - SIN(RADIANS(X(gm_coor)))
                        * COS(RADIANS(:session_lat))
                        * COS(RADIANS(Y(gm_coor) - :session_lng)), 2)),
                        (SIN(RADIANS(X(gm_coor)))
                        * SIN(RADIANS(:session_lat))
                        + COS(RADIANS(X(gm_coor)))
                        * COS(RADIANS(:session_lat))
                        * COS(RADIANS(Y(gm_coor)
                        - :session_lng))))
                        * 6372.795 AS distance
        from
            Users
        inner join
            Profiles
        on
            Users.id = Profiles.userid
        where
            Profiles.Active = 1
         and
            Profiles.firstlanguage = :firstlanguage
      HAVING
            distance < 250
    order by
            users.id desc,
            distance asc
       limit
            10";

$profiles = DB::select($sql_statement, [
    'session_lng'  => Session('lng'),
    'session_lat'  => Session('lat'),
    'firstlanuage' => $firstlanguage,
]);```