WorkersController.php
664 Bytes
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
class WorkersController extends Controller
{
public function index(Request $request) {
if ($request->ajax()) {
$user = User::find($request->id);
$request->offsetUnset('id');
$user->update($request->all());
}
$users = User::where('is_worker', '1')->paginate(15);
if ($request->ajax()) {
return view('admin.worker.index_ajax', compact('users'));
} else {
return view('admin.worker.index', compact('users'));
}
}
}