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.
 
 
 

73 lines
1.5 KiB

<?php
namespace App\Http\Controllers;
use App\Models\Marca;
use Illuminate\Http\Request;
class MarcaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$marcas = Marca::all();
return view('marcas', ["marcas" => $marcas]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$marcas = Marca::all();
return view('marcasCrearEditar',['marcas'=>$marcas]);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$marca = new Marca($request->all());
$marca->save();
return redirect()->route('marca.index');
}
/**
* Display the specified resource.
*/
public function show(Marca $marca)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$marca = Marca::find($id);
return view('marcasCrearEditar',['marca'=>$marca]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$marca = Marca::find($id);
$marca->fill($request->all());
$marca->save();
return redirect()->route('marca.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Marca $marca)
{
//
}
}