new companies Module now with full spoort migrated

This commit is contained in:
Mark Gregory
2026-07-02 11:06:52 +01:00
parent b87036e1a2
commit 7f5572989e
34 changed files with 107 additions and 215 deletions
@@ -2,78 +2,40 @@
namespace Modules\Company\Http\Controllers;
use Illuminate\Contracts\Support\Renderable;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Str;
use Modules\Company\Models\Company;
class CompanyController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
* Display companies.
*/
public function index()
{
return view('company::index');
return view('company::index', [
'companies' => Company::withCount(['users', 'warehouses', 'licenseKeys'])->latest('id')->paginate(20),
]);
}
/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
{
return view('company::create');
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Renderable
* Create a company tenant.
*/
public function store(Request $request)
{
//
}
$data = $request->validate([
'name' => ['required', 'string', 'max:255'],
'billing_email' => ['nullable', 'email', 'max:255'],
'status' => ['required', 'in:active,suspended'],
]);
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
return view('company::show');
}
Company::create([
...$data,
'slug' => Str::slug($data['name']),
'timezone' => 'Europe/London',
]);
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('company::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
return back()->with('status', 'Company created.');
}
}