public function findLatest($take = 10) { return Category::with(['employees' => function ($q) use($take) { $q->take($take); $q->orderBy('created_at', 'desc'); }, 'employees.user'])->get(); }
public function run() { Category::create(['id' => 1, 'name' => 'Backend developers', 'slug' => 'backend-developers']); Category::create(['id' => 2, 'name' => 'Frontend developers', 'slug' => 'frontend-developers']); Category::create(['id' => 3, 'name' => 'Designer', 'slug' => 'designer']); }
public function run() { Category::create(['id' => 1, 'name' => 'Senior Analyst Developer', 'slug' => 'senior-analyst-developer']); Category::create(['id' => 2, 'name' => 'Functional Analyst', 'slug' => 'functional-analyst']); Category::create(['id' => 3, 'name' => 'Document', 'slug' => 'document']); }