zhezhebie

zhezhebie

Member Since 2 Years Ago

Experience Points 700
Experience Level 1

4,300 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 6
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.

30 May
1 year ago

zhezhebie left a reply on Mimes Validation Not Working Correctly In Laravel

@tareenmj @devEs thank you devEs ,I have seen your answer !

https://laracasts.com/discuss/channels/requests/laravel-5-mimes-validator-always-returning-errors-even-with-right-mime-type

I know this thread is old, but this might help others who may stumbled on the same problem. I actually got the idea from what @rogrido said about checking your images/attachments as arrays. I am using "attachments[]" as input name by the way. And I got it working using this:

$this->validate(request(), [
        'attachments.*' => 'required|mimes:jpeg,png,pdf'
]);

using the dot(.) asterisk solved my problem.

zhezhebie left a reply on Validation Mimes And Requested Rule

'order.file' => 'sometimes|mimes:pdf|max:2000',

zhezhebie left a reply on Mimes Validation Not Working Correctly In Laravel

I come accross this bug either ! and so does the mimetypes doesn't work correctly ! when i validate excel,word and pdf , I use

dd($request->file('document')->getMimeType(),$request->file('document')->getClientOriginalExtension() );

even can't get mimetype correctly ,but sometimes it does .like below :

"application/CDFV2-unknown"
"xls"

@tareenmj @Cronix @rzvme

22 May
1 year ago

zhezhebie left a reply on HasMany Relationship To Model And Continue Use Chain Methods

@biishmar so i want to set a paramar that only when level status change to 4 ,then run this event .but i don't know how to do that ,I am digging into the code .thank you so much , if you know how to resolve this ,tell me ,thank you again . I am from China , maybe we can be friends .

zhezhebie left a reply on HasMany Relationship To Model And Continue Use Chain Methods

@biishmar think you ! this can solve my problem ,and I find another solution , mode events .such as creating,created ,updated updating ... that means you can trigger the event when you update level model ,set status=4 and change the belonging lessons to status=4 too .

    public static function boot()
    {
        parent::boot();

        static::updated(function ($course_level) {
            if ($course_level->wasChanged('status')) {
                $course_level->courseUnits()->update(['status' => 4]);
            }
        });
    }

just like this ,but it doesn't work ... what's the matter ?

21 May
1 year ago

zhezhebie started a new conversation HasMany Relationship To Model And Continue Use Chain Methods

hey , friends ,wheen I use laravel5.5,I come accross a problem , I have a level ,and there are many lessons belongs to the level ,when I soft delete the level ,I want to change all the lessons to soft delete status too ,and in production enviroment ,more Course,Level,Unit,Lesson ,when I change the parent level ,I want to change all tree child at the same time , could you give me a hand ?

    public function incrementOrDecrementLevelNum($course_level_id, $type = 1)
    {
        $level = CourseLevel::find($course_level_id);
        if ($level) {
            $course = $level->courses;
            $units = $level->courseUnits;
            $lessons = $level->courseLessons;
        } else {
            return false;
        }
        if ($type == 1) {
            $course->increment('level_num');
        } elseif ($type == -1) {
            $course->decrement('level_num');
            $unit_num = $units->count();
            $lesson_num = $lessons->count();
            $course->decrement('unit_num', $unit_num)->decrement('lesson_num', $lesson_num);
            # I want to use model's methord ,but laravel tell me this is a collection ,donn't have update method .
            $level->update(['status' => 4]);
            $units->update(['status' => 4]);
            $lessons->update(['status' => 4]);
        }
        return true;
    }

relation CourseLevel;

 public function courses()
    {
        return $this->belongsTo('App\Models\Course', 'course_id', 'id');
    }

    /**
     * belongs to many for customer
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     *
     */
    public function courseUnits()
    {
        return $this->hasMany('App\Models\CourseUnit', 'course_level_id', 'id');
    }

    /**
     * belongs to many for customer
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     *
     */
    public function courseLessons()
    {
        return $this->hasMany('App\Models\CourseLesson', 'course_level_id', 'id');
    }