aristain7

aristain7

Member Since 1 Month Ago

Experience Points 130
Experience Level 1

4,870 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-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.

17 Jun
1 month ago

aristain7 left a reply on Group By Subcollection (belongTo Relationship)

@DEANSATCH - The results that i want can be achived this way but i feel is a bit dirty

    $uncategorized = collect();
        
        $uncategorized->push(['CategoryID'=>  0,
          'CategoryName'=>  'Uncategorized',
          'CategoryCode'=>  '00',
          'CategoryGroupID'=>  $GroupID
        ]);
        
        $new = $uncategorized->map(function ($item, $key) use($GroupID){
          $sub = Warehouse::where('WarehouseCategoryID','=',0)->where('WarehouseGroupID', '=', $GroupID)->get();
          return $item=array_add($item,'warehouses',$sub);
        });
        
        $categories_with_warehouses= WarehouseCategory::with('warehouses')->whereHas('warehouses', function ($query) use($GroupID) {
            $query->where('WarehouseGroupID', '=', $GroupID);
         })->get();
        
        $all = $new->merge($categories_with_warehouses);

Is there a better way?

16 Jun
1 month ago

aristain7 left a reply on BelongsTo Inverse Results

@SNAPEY - I am trying to achieve this

Categories --- Warehouses

Uncategorized ( categories where CategoryID = null OR 0 ) ---- Warehouses (warehouses where werehouseCategoryID = null OR 0 )

aristain7 left a reply on Group By Subcollection (belongTo Relationship)

@DEANSATCH - Yes i have tried this but this way you cant have uncategorized warehouses in your results

eg

Categories (or categories where werehouseCategoryID = null) --- Warehouses

aristain7 started a new conversation Group By Subcollection (belongTo Relationship)

Hey

i have this in my controller

      $all =  $warehouse->with('category' )->where('WarehouseGroupID','=',$GroupID)->get();

and i get the following resaults

0: {WarehouseID: 1, WarehouseName: "TEST", WarehouseGroupID: -1, WarehouseCode: "244",…}
WarehouseAddress: null
WarehouseCategoryID: 13
WarehouseCity: null
WarehouseCode: "244"
WarehouseCountryID: null
WarehouseDescription: null
WarehouseGroupID: -1
WarehouseID: 1
WarehouseName: "TEST"
WarehouseRegionID: null
WarehouseStatus: 1
WarehouseUnitID: null
WarehouseUserID: null
WarehouseZipCode: null
category: {CategoryID: 13, CategoryCode: "24", CategoryName: "42424", CategoryUnitID: null, CategoryGroupID: -1,…}
CategoryCode: "24"
CategoryGroupID: -1
CategoryID: 13
CategoryName: "42424"
CategoryParentID: 11
CategoryUnitID: null
created_at: "2019-05-26 07:30:54"
updated_at: "2019-05-26 07:30:54"
created_at: "2019-04-08 17:47:34"
updated_at: "2019-04-08 17:47:34"

i want to group results by category subcollection any idea?

15 Jun
1 month ago

aristain7 started a new conversation Belongs Inverse Results

Hello

i have two models WarehouseCategory and Warehouse model

in my first model i have this

  public function warehouses()
  {
      return $this->hasMany(Warehouse::class,'WarehouseCategoryID');
  }

and in Warehouse

  public function categories()
  {
      return $this->belongsTo(WarehouseCategory::class,'WarehouseCategoryID','CategoryID');
  }

in my controller

     $warehouse = new Warehouse;
     $warehouses = $warehouse->with('categories')->get();

the problem is that in results i get

0: {WarehouseID: 1, WarehouseName: "TEST", WarehouseGroupID: -1, WarehouseCode: "244",…} WarehouseAddress: null WarehouseCategoryID: 13 WarehouseCity: null WarehouseCode: "244" WarehouseCountryID: null WarehouseDescription: null WarehouseGroupID: -1 WarehouseID: 1 WarehouseName: "TEST" WarehouseRegionID: null WarehouseStatus: 1 WarehouseUnitID: null WarehouseUserID: null WarehouseZipCode: null categories: {CategoryID: 13, CategoryCode: "24", CategoryName: "42424", CategoryUnitID: null, CategoryGroupID: -1,…} CategoryCode: "24" CategoryGroupID: -1 CategoryID: 13 CategoryName: "42424" CategoryParentID: 11 CategoryUnitID: null created_at: "2019-05-26 07:30:54" updated_at: "2019-05-26 07:30:54" created_at: "2019-04-08 17:47:34" updated_at: "2019-04-08 17:47:34"

and i want results to be grouped by categories SubArray (Also Nulls)

When i use hasMany from gategory it gives me categories with warehouse and not nulls warehouse categories