84 lines
1.7 KiB
PHP
84 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Company;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CompanyController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
$request->validate([
|
|
'name' => 'required',
|
|
'email' => 'nullable|email',
|
|
'logo' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
|
'website' => 'nullable|url',
|
|
]);
|
|
|
|
$company = new Company;
|
|
$company->name = $request->name;
|
|
$company->email = $request->email;
|
|
if ($request->hasFile('logo')) {
|
|
$path = $request->file('logo')->store('logos', 'public');
|
|
$company->logo = $path;
|
|
}
|
|
$company->website = $request->website;
|
|
$company->save();
|
|
|
|
return redirect()->route('companies.index');
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(Company $company)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(Company $company)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, Company $company)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(Company $company)
|
|
{
|
|
//
|
|
}
|
|
}
|