⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
crm.dev-unit.com
/
app
/
Http
/
Controllers
/
View File Name :
GoalController.php
<?php namespace App\Http\Controllers; use App\Http\Requests\CreateGoalRequest; use App\Http\Requests\UpdateGoalRequest; use App\Models\Goal; use App\Repositories\GoalRepository; use Exception; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Response; use Illuminate\Routing\Redirector; use Illuminate\View\View; use Laracasts\Flash\Flash; class GoalController extends AppBaseController { /** @var GoalRepository */ private $goalRepository; public function __construct(GoalRepository $goalRepo) { $this->goalRepository = $goalRepo; } /** * Display a listing of the Goal. * * @return Factory|View */ public function index() { $goalTypes = Goal::GOAL_TYPE; return view('goals.index', compact('goalTypes')); } /** * Show the form for creating a new Goal. * * @return Factory|View */ public function create() { $members = $this->goalRepository->getStaffMember(); $goalTypes = Goal::GOAL_TYPE; return view('goals.create', compact('members', 'goalTypes')); } /** * Store a newly created Goal in storage. * * @param CreateGoalRequest $request * @return RedirectResponse|Redirector */ public function store(CreateGoalRequest $request) { $input = $request->all(); $this->goalRepository->store($input); Flash::success(__('messages.goal.goal_saved_successfully')); return redirect(route('goals.index')); } /** * Display the specified Goal. * * @param Goal $goal * @return Factory|View */ public function show(Goal $goal) { $goal = $this->goalRepository->getGoalDetails($goal->id); return view('goals.show', compact('goal')); } /** * Show the form for editing the specified Goal. * * @param Goal $goal * @return Factory|View */ public function edit(Goal $goal) { $data = []; $data['goalMembers'] = $goal->goalmembers()->pluck('user_id')->toArray(); $members = $this->goalRepository->getStaffMember(); $goalTypes = Goal::GOAL_TYPE; return view('goals.edit', $data, compact('goal', 'members', 'goalTypes')); } /** * Update the specified Goal in storage. * * @param UpdateGoalRequest $request * @param Goal $goal * @return RedirectResponse|Redirector */ public function update(UpdateGoalRequest $request, Goal $goal) { $input = $request->all(); $this->goalRepository->updateGoal($goal->id, $input); Flash::success(__('messages.goal.goal_saved_successfully')); return redirect(route('goals.index')); } /** * Remove the specified Goal from storage. * * @param Goal $goal * @return Response * * @throws Exception */ public function destroy(Goal $goal) { activity()->performedOn($goal)->causedBy(getLoggedInUser()) ->useLog('Goal deleted.')->log($goal->subject.' Goal deleted.'); $goal->delete(); return $this->sendSuccess('Goal deleted successfully.'); } }