Skip to content

Instantly share code, notes, and snippets.

@DvdQzd
Last active January 11, 2019 13:30
Show Gist options
  • Save DvdQzd/38a2ef989e80db41c6bcc775dccd4cd0 to your computer and use it in GitHub Desktop.
Save DvdQzd/38a2ef989e80db41c6bcc775dccd4cd0 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Pokemon;
class PokemonController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//Instanciamos la clase Pokemons
$pokemon = new Pokemon;
//Declaramos el nombre con el nombre enviado en el request
$pokemon->name = $request->name;
//Guardamos el cambio en nuestro modelo
$pokemon->save();
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//Solicitamos al modelo el Pokemon con el id solicitado por GET.
return Pokemon::where('id', $id)->get();
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment