Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created September 26, 2020 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/d8acebe010db4be79c1c7682f5649422 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/d8acebe010db4be79c1c7682f5649422 to your computer and use it in GitHub Desktop.
<template>
<div>Listado de posts</div>
</template>
<script>
// resources/js/Pages/Posts/Index.vue
export default {
name: "PostsList",
props: {
posts: Object,
}
}
</script>
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use Inertia\Inertia;
class PostController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Inertia\Response
*/
public function index()
{
return Inertia::render("Posts/Index", [
"posts" => Post::paginate(),
]);
}
}
<?php
use App\Http\Controllers\PostController;
Route::get('/posts', [PostController, "index"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment