public function automate($email, $slugs = []) { $user = User::query()->where('email', $email)->first(); foreach ($slugs as $slug) { $taskExemption = new TaskExemption(); $task = Task::query()->where('slug', $slug)->first(); $taskExemption->user_id = $user->id; $taskExemption->task_id = $task->id; $taskExemption->save(); } }
/** * Display a listing of the Tasks. * * @return Response */ public function index() { $query = Task::query(); return response()->json($query->paginate()); }