MrChrxs

Member Since 3 Years Ago

Experience Points
18,920
Total
Experience

1,080 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
187
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

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

Level 4
18,920 XP
May
06
1 month ago
Activity icon

Started a new Conversation Install Valet For Multiple Users

Hello,

Yesterday, I set myself up a "work" user on my Mac. I installed and went to use Valet, and found that it was trying to access sites from my "personal" user.

I was wondering if this was common, and if it could be fixed to be used over 2 user accounts on the same Mac.

Mar
15
2 months ago
Activity icon

Started a new Conversation Trouble Converting SQL To HasManyThrough

Hello,

I'm trying to convert an SQL Query to a relationship in Eloquent, and having great difficulty.

This is my SQL Query:

select		Delegate.ID,
			Delegate.fldFIRSTNAME,
			Delegate.fldLASTNAME,
			Delegate.fldNICKNAME,
			Delegate.fldCOMPANY,
			Delegate.fldTEL,
			Delegate.fldSTRIPECUSTOMERID,
			Delegate.fldEMAIL,
			EventLocationDelegateStatus.fldSTATUSID
from		[nm_tbl_user] as [Delegate]
inner join	[nm_tbl_cate_puser_user] as [EventLocationDelegateStatus]
on			[EventLocationDelegateStatus].[ID] = (
				SELECT		TOP 1
							LatestEventLocationDelegateStatus.ID
				FROM		nm_tbl_cate_puser_user AS LatestEventLocationDelegateStatus
				WHERE		LatestEventLocationDelegateStatus.fldUID		=	Delegate.ID
				AND			LatestEventLocationDelegateStatus.fldCID		IN (6964)
				ORDER BY	LatestEventLocationDelegateStatus.ID DESC
			)
WHERE		EventLocationDelegateStatus.fldSTATUSID	IN (6)

This is the type of thing I'm trying to achieve:

 public function registeredDelegates()
	{
		return $this->hasManyThrough(
			    Delegate::class,
			    DelegateLocationStatus::class,
			    'fldCID',
			    'ID', 
			    'ID',
			    'fldUID'
		)->where('nm_tbl_cate_puser_user.ID', function($q) {
			return $q->select('fldSTATUSID')
			->from('nm_tbl_cate_puser_user')
			->where('fldSTATUSID', 6)
			->orderBy('ID', 'DESC')
			->limit(1);
		});
	}

The relationship works, but I'm trying to fetch the last record in the DelegateLocationStatus pivot, ONLY if that last record has a fldSTATUSID of 6.

So far I'm fetching 17 records, when it should be 16, because of the where('fldSTATUSID') isn't work as intended, it's pulling back a second-to-last record where the fldSTATUSID is 6, the last record is actually fldSTATUSID of 17.

Can anyone please help me figure out where I am going wrong, and how I can achieve this using Eloquent/Model Relationships?

Thank you.

Mar
10
3 months ago
Activity icon

Started a new Conversation Last Record In HasMany Pivot

I'm trying to get the last record in a pivot table in a HasManyThrough. There's 4 tables: Delegate Location Status DelegateLocationStatus

In the DelegateLocationStatus table there are duplicate records for each Delegate, showing the progress of each status. I'm looking to only fetch the last record for the Delegates that have a particular StatusID as their last record in the DLS Table.

return $this->hasManyThrough( Delegate::class, DelegateLocationStatus::class, 'fldCID', // Foreign key on the environments table... 'ID', // Foreign key on the deployments table... 'ID', // Local key on the projects table... 'fldUID' // Local key on the environments table... ); I've tried adding in where clauses like so

return $this->hasManyThrough( Delegate::class, DelegateLocationStatus::class, 'fldCID', // Foreign key on the environments table... 'ID', // Foreign key on the deployments table... 'ID', // Local key on the projects table... 'fldUID' // Local key on the environments table... )->where('nm_table_user', function($q) { $q->select('fldSTATUSID') ->from('nm_tbl_cate_puser_user') ->where('fldSTATUSID', '=', 6) ->orderBy('ID', 'DESC') ->limit(1); }); But I really can't figure out how to only target the last record in DLS Table where the StatusID is 6.

I hope this makes sense. Thank you.