You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.4 KiB
69 lines
1.4 KiB
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Auto;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AutoController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$autos = Auto::all();
|
|
return view('autos', ['autos' => $autos]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
return view('autosCrearEditar', ['auto' => null]);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
$auto = Auto::create($request->all());
|
|
return redirect()->route('autos.index');
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(Auto $auto)
|
|
{
|
|
return view('autosCrearEditar', ['auto' => $auto]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(Auto $auto)
|
|
{
|
|
return view('autosCrearEditar', ['auto' => $auto]);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, Auto $auto)
|
|
{
|
|
$auto->update($request->all());
|
|
return redirect()->route('autos.index');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(Auto $auto)
|
|
{
|
|
$auto->delete();
|
|
return redirect()->route('autos.index');
|
|
}
|
|
}
|
|
|