ollie_123

Member Since 1 Year Ago

Experience Points
18,570
Total
Experience

1,430 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
78
Lessons
Completed
Best Reply Awards
7
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,570 XP
May
16
2 days ago
Activity icon

Replied to Trying To Access Relationship But Property [services] Does Not Exist On This Collection Instance

Sorry it was a bad example. Yes i'm aware of get and the potential of calling X amount of records. I only wrote get() for simplicity.

Essentially, i'm trying to sum the services on the line items table as follows:-

// Component
$job =  Job::where('uuid', $uuid)->first();
$this->netValue = $job->getNetValueAttribute();

// Job Model
public function getJobNetValueAttribute()
    {
       
        return $this->jobLineItems->services->sum('unit_sale_price');
    }

but get the services error i initially listed.

Activity icon

Started a new Conversation Trying To Access Relationship But Property [services] Does Not Exist On This Collection Instance

Hi All

I'm trying to access a relationship through another relationship but am getting the error:- Property [services] does not exist on this collection instance

Im trying to access it like

$jobs = Job::get();
$jobs->jobLineItems->services;

but am getting the above error.

My table structure is as follows:-

Jobs Table
id | ......

JobLineItems Table
id | job_id | service_id | qty

Services Table
id | name | etc....

// Job Model
 public function jobLineItems()
    {
        return $this->hasMany(JobLineItem::class);
    }

// JobLineItem Model
 public function jobs()
    {
        return $this->belongsTo(Job::class, 'job_id');
    }
 public function services()
    {
        return $this->belongsTo(Service::class, 'service_id');
    }

// Service Model
    public function jobLineItems()
    {
        return $this->hasMany(JobLineItem::class);
    }

Please can someone advise where i might be going wrong.

Jan
16
4 months ago
Activity icon

Replied to Chart JS & Laravel Order Issue

Thanks @nimrod. I did try swapping them earlier but then i got Jan 2021 | Oct 2020 | Nov 2020 | Dec 2020.

I'll keep tinkering.

Activity icon

Replied to Chart JS & Laravel Order Issue

Hi @nimrod no they arent in the correct order coming from the DB. As i said, i tried orderBy but its not ordering the data as required.

Activity icon

Started a new Conversation Chart JS & Laravel Order Issue

Hi All

I'm using Chart JS with a bar chart on my app dashboard but when the data is displayed the month order is incorrect with Jan 202 in the middle of Oct 2020 & Nov 2020.

I tried adding OrderBy but it doesn't seem to have much effect.

Please can someone advise where i might be going wrong?

$orderCountByMonth = InvoiceLineItems::select(
                \DB::raw('sum(prod_sale) as sums'), 
                \DB::raw("DATE_FORMAT(created_at,'%M %Y') as months")
                )
                ->orderBy('months', 'desc')
                ->groupBy('months')
                ->get();

Thanks in advance.

Nov
24
5 months ago
Activity icon

Awarded Best Reply on How Do I Get The Current Date In This Format Wednesday 26 Aug

Hey @tomasosho

You could use carbon for this and do something like:-

use Carbon\Carbon;

$d = '2020/08/26'; // Your date from database...
$day = Carbon::parse($d)->format('l m F');

Which will show: Wednesday 08 August

Activity icon

Replied to 3 Table Structure - To Pivot Or Not To Pivot?

Any advice would be greatly appreciated.

Thank you in advance.

Nov
22
5 months ago
Activity icon

Started a new Conversation 3 Table Structure - To Pivot Or Not To Pivot?

Hi All

I'm looking for a bit of advice on how to structure my tables. I'm creating a CRM where i would ideally not have to use separate pricebooks for all of the products as it then becomes a nightmare to maintain.

The models i have are

-Company
-ProductFamily (hasMany Product)
-Discount

A company can belongToMany ProductFamily A ProductFamily hasMany Discount

I was thinking of a pivot table between the three tables company_discount_family with a belongsToMany on each but i'm not sure if this is the best way.

The aim is when the user creates a quote against a company, it automatically selects the customer discount against the brand for each product.

I've been looking at it for a couple of days and i'm not sure if the Pivot table is the right solution.

Please could someone advise?

Thanks in advance.