/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $crs = Course::find($id); $aff = Affiliate::all(); $stm = Stream::all(); $lvl = Level::all(); return view('admin/edit_course')->with('course', $crs)->with('affiliates', $aff)->with('streams', $stm)->with('levels', $lvl); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $learners = \App\Student::all(); $staff = Staff::all(); $subjects = \App\Subject::all(); $streams = \App\Stream::all(); $classes = \App\Grade::all(); return view('admin.index')->with('title', 'SMS|Dashboard')->with('learners', $learners)->with('staff', $staff)->with('subjects', $subjects)->with('streams', $streams)->with('classes', $classes); }
private function groupStream(Problem $problem, Group $group) { $user = Auth::user(); $groupRepository = new GroupRepository(); $joins = $groupRepository->getAllJoinUsers($group); foreach ($joins as $join) { Stream::create(['user_id' => $join->id, 'contentable_id' => $problem->id, 'contentable_type' => 'App\\Problem', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]); } Stream::create(['user_id' => $user->id, 'contentable_id' => $problem->id, 'contentable_type' => 'App\\Problem', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 1]); }
private function stream($friendship) { $friendRepository = new FriendRepository(); $friends = $friendRepository->myFriends(); $user = Auth::user(); foreach ($friends as $friend) { Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $friendship->id, 'contentable_type' => 'App\\Friend', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 0]); } Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $friendship->id, 'contentable_type' => 'App\\Friend', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 1]); }
private function stream($recommendation) { $authUser = Auth::user(); $user = $recommendation->skill->user; $friendRepository = new FriendRepository(); $friends = $friendRepository->friendsOf($user->id); foreach ($friends as $friend) { $is_see = 0; if ($authUser->id == $friend->friend_info->id) { $is_see = 1; } Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $recommendation->id, 'contentable_type' => 'App\\Recommendation', 'parentable_id' => $authUser->id, 'parentable_type' => 'App\\User', 'is_see' => $is_see]); } Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $recommendation->id, 'contentable_type' => 'App\\Recommendation', 'parentable_id' => $authUser->id, 'parentable_type' => 'App\\User', 'is_see' => 0]); }
public function assign_stream(Requests\AssignStreamRequest $request) { $stream = Stream::find($request->stream_id); $year = date('Y'); if ($stream) { $status = 1; //update the student table to reflect that the student has been attached to class $student = Student::find($request->learner_id); $student->status = $status; $student->save(); $student->streams()->attach($request->stream_id, array('year' => $year)); //inserts the tables return Redirect::back()->with('message', 'Learner assigned succesfully'); } }
/** * Created By Dara on 1/11/2015 * group post stream */ private function groupStream($post, $group) { $user = Auth::user(); $groupRepository = new GroupRepository(); $joins = $groupRepository->getAllJoinUsers($group); //return the users of the group except current foreach ($joins as $join) { Stream::create(['user_id' => $join->id, 'contentable_id' => $post->id, 'contentable_type' => 'App\\Post', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]); } Stream::create(['user_id' => $user->id, 'contentable_id' => $post->id, 'contentable_type' => 'App\\Post', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 1]); }
private function stream($receivers, $poll) { foreach ($receivers as $receiver) { if ($poll->user_id != $receiver) { Stream::create(['user_id' => $receiver, 'edge_ranke' => 0, 'contentable_id' => $poll->id, 'contentable_type' => 'App\\Poll', 'parentable_id' => $poll->user_id, 'parentable_type' => 'App\\User', 'is_see' => 0]); } } Stream::create(['user_id' => $poll->user_id, 'edge_ranke' => 0, 'contentable_id' => $poll->id, 'contentable_type' => 'App\\Poll', 'parentable_id' => $poll->user_id, 'parentable_type' => 'App\\User', 'is_see' => 1]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { try { $stm = Stream::find($id); $stm->delete(); \Session::flash('sucess_message', 'Stream sucessfully DELETED'); } catch (\Exception $e) { \Session::flash('error_message', 'Stream could not DELETED'); } return redirect('myAdmin/streams'); }
public function approvedStream(Showcase $showcase) { Stream::create(['user_id' => $showcase->user_id, 'contentable_id' => $showcase->id, 'contentable_type' => 'App\\Showcase', 'parentable_id' => $showcase->profile_id, 'parentable_type' => 'App\\User', 'is_see' => 0]); }
public function group($group) { $user = Auth::user(); $streams = Stream::where('parentable_type', 'App\\Group')->where('parentable_id', $group->id)->where('user_id', $user->id)->latest()->get(); foreach ($streams as $stream) { if ($stream->contentable_type == 'App\\Post') { $this->feed[] = $this->postGroup($stream->contentable); } elseif ($stream->contentable_type == 'App\\Problem') { $this->feed[] = $this->problem($stream->contentable); } } return $this->feed; }
/** * Created By Dara on 1/12/2015 * create the stream after submitting a corporation */ private function acceptanceStream($corporation, $senderId) { Stream::create(['user_id' => $senderId, 'edge_rank' => 0, 'contentable_id' => $corporation->id, 'contentable_type' => 'App\\Corporation', 'parentable_id' => $senderId, 'parentable_type' => 'App\\User', 'is_see' => 0]); }
private function stream($article) { $user = Auth::user(); $friendRepository = new FriendRepository(); $friends = $friendRepository->myFriends(); foreach ($friends as $friend) { Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $article->id, 'contentable_type' => 'App\\Article', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 0]); Event::fire(new Notification($friend->friend_info->id, 'App\\Article', $article)); } Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $article->id, 'contentable_type' => 'App\\Article', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 1]); }
public function run() { Stream::create(['streaming' => 0]); }
private function groupStream(Comment $comment) { $user = Auth::user(); $owner = $comment->commentable->user; if ($user->id != $owner->id) { Stream::create(['user_id' => $owner->id, 'edge_ranke' => 0, 'contentable_id' => $comment->id, 'contentable_type' => 'App\\Comment', 'parentable_id' => $user->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]); } }