Abdifatah

Abdifatah

Software Engineer at Somcoders.com

Member Since 4 Years Ago

Laascaanood

Experience Points
18,830
Total
Experience

1,170 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
174
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 4
18,830 XP
Oct
02
3 weeks ago
Activity icon

Replied to How To Select Specific Columns When Using With Function In Eloquent Laravel?

Thank you @michaloravec but when I use only course_id field it return empty array why?

$user =  App\User::with('courses:course_id')->findOrFail(387);
Activity icon

Started a new Conversation How To Select Specific Columns When Using With Function In Eloquent Laravel?

This is the relationship between the user and his courses

#User class -> user.php
public function courses()
    {
        return $this->hasMany(course::class);
    }

#Web  - routes
route::get("test", function () {
    $user =  App\User::whereId(auth::id())->with("courses")->get();
    return response()->json($user);
});

I tried to user pluck() and select() functions but it's returning empty courses array. Instead of returning all courses columns , How can I return specific columns like course_id?

{
  "id": 387,
  "firstname": "example",
  "courses": [
    {
      "id": 25,
      "user_id": 387,
      "course_id": 30,
    },
    {
      "id": 26,
      "user_id": 387,
      "course_id": 39,

    }
  ]
}
Sep
14
1 month ago
Activity icon

Commented on Improved Rate Limiting

Waaw , Rate limiting is cool, Thanks Jeffrey.

Aug
02
2 months ago
Activity icon

Replied to Laravel Excel Export Model With Relationship

Thanks @haz_ if you understand me , I want to export master detail


public function map($jobs): array
    {
        return [
            [
                $jobs->id,
                $jobs->position,
                $jobs->full_name,
                $jobs->mother_name
            ],
            [

                $jobs->work // how to loop work
            ],

            [

                $jobs->education
            ]

        ];

This works but work and education become one json excel column when I export it.

Aug
01
2 months ago
Activity icon

Started a new Conversation Laravel Excel Export Model With Relationship

This code only returns the Job Model only.


public function collection()
    {
        $jobs = Job::with("work")->get();
        return $jobs;
    }

I need each model rows with their corresponding child rows to appear inside it , just like nested table.

May
31
4 months ago
Activity icon

Replied to Laravel Get Current URL Parameters And Prepend The Locale

@tykus Thank You so much

This is how I fixed

$route = Route::getCurrentRoute();
$routeParameters = $route->parameters;
$shifted = array_shift($routeParameters);
$routeName = $route->getName();
$params = array_values($routeParameters);

 <a href="{{ route($routeName, array_merge(['so'], $params)) }}">Somali</a>
 <a href="{{ route($routeName, array_merge(['en'], $params)) }}">English</a>
 <a href="{{ route($routeName, array_merge(['ar'], $params)) }}">Arabic</a>

Activity icon

Replied to Laravel Get Current URL Parameters And Prepend The Locale

@tykus No, all my routes are using locale, but they have different parameters Like this below

Route::get('/{name}/{sid}/lesson/{lid}', '[email protected]');
Route::post('/lesson/{subjectName}/{lid}/new', '[email protected]');
Route::post('/{name}/{sid}/reply', '[email protected]');
Activity icon

Started a new Conversation Laravel Get Current URL Parameters And Prepend The Locale

I need to create a language switcher anchor tags. So I need to get the full url and prepend first segment to selected language.

I tried Route::currentRouteName(); method but it fails when dealing routes with different params. so I tried

   url()->full(); 
//bu it returns full url and I can't prepend
http://127.0.0.1:8000/en/profile/3
May
28
4 months ago
Activity icon

Replied to Why Isn't My Database Notification Working? Data Column Empty

Use toArray Function

 public function toArray($notifiable)
    {
        return [
            'user'  => $this->user
        ];
    }
Activity icon

Started a new Conversation Laravel Localization Different Route Parameters

  <a href="{{ route(Route::currentRouteName(),'en')}}">English</a>
 <a href="{{ route(Route::currentRouteName(),'so')}}">Somali</a>

I have routes with different parameters but the above function works only routes with no parameters and it works as expected returning **{language}/url ** but if I have route with parameters like below

Route::get('/lesson/{id}', '[email protected]');

It return {langauge}/url only instead of {langauge}/url/id

I need to get the full url prepend with language prefix or Is there is an other solution?

Apr
28
5 months ago
Activity icon

Commented on Headless Livewire

So helpfull. What if I need to put video livewire/video-view.blade.php instead of views/video-view.blade.php? Is there is way that implementation work?

Activity icon

Commented on Headless Livewire

Amazing , Thank You @kevin_mckee.