.
This commit is contained in:
34
app/Http/Controllers/Configuration/CompanyController.php
Normal file
34
app/Http/Controllers/Configuration/CompanyController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Configuration;
|
||||
|
||||
use App\Company;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$companies = Company::all();
|
||||
return view('configuration.companies', compact('companies'));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
if ($id) {
|
||||
$company = Company::find($id);
|
||||
} else {
|
||||
$company = Company::getModel();
|
||||
}
|
||||
if ($request->post()) {
|
||||
$company->name = $request->get('name');
|
||||
$company->monthly_payer = $request->get('monthly_payer');
|
||||
$company->save();
|
||||
return redirect()->route('company')->with('success', 'Uloženo');
|
||||
}
|
||||
|
||||
return view('configuration.company.edit', compact('company'));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user