📁 File Manager Pro
v10.0.3 | PHP: 8.2.31
Server: LiteSpeed
2026-07-02 13:47:40
📂
/ (Root)
/
home
/
orkouolp
/
web
/
testing.orkobd
/
laravel
/
app
/
Http
/
Controllers
/
Admin
📍 /home/orkouolp/web/testing.orkobd/laravel/app/Http/Controllers/Admin
🔄 Refresh
✏️
Editing: OrganizationTypeController.php
Writable
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\OrganizationType; use App\Services\Notify; use App\Traits\Searchable; use Illuminate\Http\Request; class OrganizationTypeController extends Controller { use Searchable; /** * Display a listing of the resource. */ public function index() { $query = OrganizationType::query(); $this->search($query, ['name']); $organizationTypes = $query->paginate(20); //1 return view('admin.organization-type.index', compact('organizationTypes')); } /** * Show the form for creating a new resource. */ public function create() { return view('admin.organization-type.create'); } /** * Store a newly created resource in storage. */ public function store(Request $request) { $request->validate([ 'name' => ['required', 'max:255', 'unique:organization_types,name'] ]); $type = new OrganizationType(); $type->name = $request->name; $type->save(); Notify::createdNotification(); return to_route('admin.organization-types.index'); } /** * Display the specified resource. */ // public function show(string $id) // { // // // } /** * Show the form for editing the specified resource. */ public function edit(string $id) { $organizationType = OrganizationType::findOrFail($id); return view('admin.organization-type.edit', compact('organizationType')); } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { $request->validate([ 'name' => ['required', 'max:255', 'unique:organization_types,name,'.$id] ]); $type = OrganizationType::findOrFail($id); $type->name = $request->name; $type->save(); Notify::updatedNotification(); return to_route('admin.organization-types.index'); } /** * Remove the specified resource from storage. */ public function destroy(string $id) { try { OrganizationType::findOrFail($id)->delete(); //100 Notify::deletedNotification(); response(['message' => 'success'], 200); } catch(\Exception $e) { logger($e); response(['message' => 'Something Went Wrong Please Try Again!'], 500); } } }
💾 Save Changes
❌ Cancel