This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('/', function() | |
{ | |
return View::make('hello'); | |
}); | |
// 投稿formを表示する | |
Route::get('posts/create', 'PostController@create'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PostController extends BaseController{ | |
function create(){ | |
return View::make('posts.create'); | |
} | |
function store(){ | |
DB::table('posts')->insert([ | |
'title'=>Input::get('title'), | |
'body'=>Input::get('body') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<form method="post" action="../posts"> | |
<label for="title">title</label><br> | |
<input type="text" name="title"><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<h1>Posts list <a href="./posts/create">create a new post</a></h1> | |
<ul> | |
<?php foreach($posts as $post){ ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<h1><?php echo $post->title ?></h1> | |
<p><?php echo $post->body ?></p> | |
<a href="./">back to list</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.master') | |
@section('title') | |
Posts list - mylaravel | |
@stop | |
@section('body') | |
<h1>Posts list {{link_to('posts/create','create a new post'))}}</h1> | |
<ul> | |
@foreach($posts as $post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.master') | |
@section('title') | |
Create a new post - mylaravel | |
@stop | |
@section('body') | |
{{Form::open(['url'=>'posts','method'=>'post'])}} | |
{{Form::label('title', 'Title')}}<br> | |
{{Form::text('title')}}<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.master') | |
@section('title') | |
{{$post->title}} - mylaravel | |
@stop | |
@section('body') | |
<h1>{{$post->title}}</h1> | |
<p>{{$post->body}}</p> | |
{{link_to('posts', 'Back to list')}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title> | |
@yield('title') | |
</title> | |
</head> | |
<body> | |
@yield('body') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('/', function() | |
{ | |
return View::make('hello'); | |
}); | |
Route::resource('posts', 'PostController'); |
OlderNewer