aarad

aarad

Member Since 1 Year Ago

Experience Points 190
Experience Level 1

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

08 Jun
1 week ago

aarad left a reply on Ho To Sorting Related Articles Based On Common Tags?

@TISUCHI - Thanks, but can you give me an example please?

aarad left a reply on Ho To Sorting Related Articles Based On Common Tags?

Thanks, but can you give me an example please?

aarad started a new conversation Ho To Sorting Related Articles Based On Common Tags?

I have an articles and tags table. Every article can have multi tags. I want to get related articles for an article and sort result based on common tags. I use this code to get related articles but i don't know how to sort result based on common tags.

    $relatedArticle = Article::whereHas('tags', function($query) use ($article){
            $query->whereIn('name', $article->tags->pluck('name'));
        })->where('id', '!=', $article->id)->take(10)->get();
16 May
1 month ago

aarad started a new conversation Vue-jalali-moment Filter Not Work Correctly On V-for

Hello I want to have a select with jalai year format, and i use 'vue-jalali-moment' for it.

<template>
    <div>                                                       
            <select class="select-year" v-model="year" v-select2>
                <option v-for="year in years" :value="year">
                @{{ year | moment("jYYYY")}}
            </option>
        </select>
    </div>
</template>
<script>
    import select2 from 'select2';
    export default {
        name: "Profile",      
        data(){
            return {
                info: this.user,

                year: '',
                month: '',
                day: '',
            }
        },
        mounted() {           
            $('.select-year').select2({
                width: '100%',
                minimumResultsForSearch: -1,
            });
            $('.select-month').select2({
                width: '100%',
                minimumResultsForSearch: -1,
            });
            $('.select-day').select2({
                width: '100%',
                minimumResultsForSearch: -1,
            });            
        },     
        computed : {
            years () {
                const year = new Date().getFullYear()
                return Array.from({length: year - 1900}, (value, index) => 1901 + index)
            }
        }
    }
</script>

I have a problem, the output is wrong:

<select>
    <option value="1901" data-select2-id="15">1348</option>
    <option value="1902" data-select2-id="16">1348</option>
    <option value="1903" data-select2-id="17">1348</option>
    <option value="1904" data-select2-id="18">1348</option>
    .
    .
    .
    <option value="2017" data-select2-id="131">1348</option>
    <option value="2018" data-select2-id="132">1348</option>
    <option alue="2019" data-select2-id="133">1348</option>
</select>

It only generate 1348 for any gregorian year. Why is not work correctly?

03 May
1 month ago

aarad left a reply on How To Get Only One Row Of One To Many With Condition?

@STAUDENMEIR - ``` Collection {#1326 ▼ #items: array:3 [▼ 0 => 75000 1 => 150000 2 => 98000 ] }

02 May
1 month ago

aarad left a reply on How To Get Only One Row Of One To Many With Condition?

@STAUDENMEIR - HasOne is a great way to get only one row of relation, but the sort still not work:

[
{
    id: 1,
    brand_id: 3,
    category_id: 5,
    title: "product one",
    sales: 2,
    weight: 300,
    created_at: "2019-04-27 15:35:01",
    updated_at: "2019-05-02 15:58:28",
    deleted_at: null,
    latest_inventory: {
        id: 1,
        product_id: 1,
        count: 9,
        buy_price: 50000,
        price: 75000,
        expiration_date: null
    }
},
{
    id: 2,
    brand_id: 2,
    category_id: 7,
    title: "product two",
    sales: 12,
    weight: 150,
    created_at: "2019-04-28 15:35:01",
    updated_at: "2019-05-02 15:58:28",
    deleted_at: null,
    latest_inventory: {
        id: 2,
        product_id: 2,
        count: 6,
        buy_price: 125000,
        price: 150000,
        expiration_date: null
    }
},
{
    id: 3,
     brand_id: 5,
    category_id: 2,
     title: "product three",
     sales: 7,
    weight: 200,
    created_at: "2019-04-27 12:12:42",
    updated_at: "2019-04-27 12:12:42",
    deleted_at: null,
    latest_inventory: {
        id: 3,
        product_id: 3,
        count: 6,
        buy_price: 75000,
        price: 98000,
        expiration_date: null
}
]

aarad left a reply on How To Get Only One Row Of One To Many With Condition?

@MARTINBEAN - As is said first() or take() only return one inventory only for first or last product, although every product has many inventory.

//products
{
   id: 1,
   brand_id: 3,
   category_id: 5,
   title: "product one",
   sales: 2,
   weight: 300,
   created_at: "2019-04-27 12:12:42",
   updated_at: "2019-04-27 12:12:42",
   deleted_at: null,
   inventories: [
      {
         id: 1,
         product_id: 1,
         count: 10,
         price: 75000,
         expiration_date: null
      }
   ]
},
{
   id: 2,
   brand_id: 2,
   category_id: 7,
   title: "product two",
   sales: 12,
   weight: 150,
   created_at: "2019-04-27 12:12:42",
   updated_at: "2019-04-27 12:12:42",
   deleted_at: null,
   inventories: []
},
{
   id: 3,
   brand_id: 5,
   category_id: 2,
   title: "product three",
   sales: 7,
   weight: 200,
   created_at: "2019-04-27 12:12:42",
   updated_at: "2019-04-27 12:12:42",
   deleted_at: null,
   inventories: []
   },
}

aarad started a new conversation How To Get Only One Row Of One To Many With Condition?

I have many product that each product can has many inventory in inventories table. I want to sort each product.inventories by inventory.id that inventory.count > 0 and get first. Then i want to sort products by inventory.price. Sorry for my bad english.