bluebeard

bluebeard

Member Since 4 Years Ago

Tortuga

Experience Points
61,470
Total
Experience

3,530 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
605
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.

Level 13
61,470 XP
Apr
23
4 months ago
Activity icon

Replied to Update Or Create

Omgg this work!!! Thank you very much!!! You very help me!!!

Activity icon

Replied to Update Or Create

Yes one to one

User Model:

// 1 User have 1 profile settings (ONE TO ONE)
public function profile_settings(){
    return $this->hasOne(Profile_Settings::class);
}

Profile_Settings Model:

 // Fill in db
protected $fillable = [
    'first_name', 'last_name', 'phone_number',
    'gender', 'date_of_birth', 'about_me',
    'address', 'city', 'country', 'postal_code',
];

// Profile settigns model belongs to User
public function user(){
    return $this->belongsTo(User::class);
}
Activity icon

Started a new Conversation Update Or Create

The user has a profile setting. I want if the user changes some fields to be updated. But I have a new column created and should be updated. Maybe someone is not doing it right. Help please. Thank you very much.

Task: I will tell you my task. the user has a setting profile model. When the profile of the new field is not yet filled. When it is filled, the column in the base is displayed. But maybe something will change over time. I need to update the same column, and not create a new column.

Controller:

 public function profile_settings_post(Request $request){
      // Auth Specialist
      $user = Auth::user();
      // Data Specialist Validate
      $data = $request->validate([
          'first_name' => 'nullable|string',
          'last_name' => 'nullable|string',
          'phone_number' => 'nullable|integer',
          'gender' => 'nullable',
          'date_of_birth' => 'nullable',
          'about_me' => 'nullable',
          'address' => 'nullable',
          'city' => 'nullable|string',
          'country' => 'nullable|string',
          'postal_code' => 'nullable|integer',
      ]);
        $profile = $user->profile_settings()->updateOrCreate($data);
        $profile->save();

      // RETURN REDIRECT PROFILE SETTINGS INDEX
    return redirect()->route('frontend.specialist.profile.settings');
}
Apr
19
5 months ago
Activity icon

Replied to Please Help! If I Edit All The Fields Does Not Work. Not Saving What Edited

Hi Snapey, your method it works, but update data in database create new columns

public function profile_settings_post(Request $request){
      // Auth Specialist
      $user = Auth::user();
      // Data Specialist Validate
      $data = $request->validate([
          'first_name' => 'nullable|string',
          'last_name' => 'nullable|string',
          'phone_number' => 'nullable|integer',
          'gender' => 'nullable',
          'date_of_birth' => 'nullable',
          'about_me' => 'nullable',
          'address' => 'nullable',
          'city' => 'nullable|string',
          'country' => 'nullable|string',
          'postal_code' => 'nullable|integer',
      ]);
        $profile = $user->profile_settings()->firstOrCreate($data);
        $profile->save();
      // RETURN REDIRECT PROFILE SETTINGS INDEX
    return redirect()->route('frontend.specialist.profile.settings');
}

profile_settings table have 2 columns user_id = 12 not update column.

Apr
11
5 months ago
Activity icon

Started a new Conversation Is It Possible To Make A Taxi Platform On Laravel?

Need to make a program for Laravel (Taxi booking). there will be a booking. But the client must show on the map where the taxi driver. How do you advise to do? thanks for the comments.