Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
愚公移山(The foolish old man removes the mountains)

Junyoung Choi Rokt33r

🐢
愚公移山(The foolish old man removes the mountains)
View GitHub Profile
@Rokt33r
Rokt33r / routes.php
Last active Aug 29, 2015
Laravel 基礎 Lesson 4 - DB (app/routes.php)
View routes.php
<?php
Route::get('/', function()
{
return View::make('hello');
});
// 投稿formを表示する
Route::get('posts/create', 'PostController@create');
@Rokt33r
Rokt33r / PostController.php
Created Mar 29, 2014
Laravel 基礎 Lesson 4 - DB (app/controllers/PostController.php)
View PostController.php
<?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')
@Rokt33r
Rokt33r / create.php
Created Mar 29, 2014
Laravel 基礎 Lesson 4 - DB (app/views/posts/create.php)
View create.php
<!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>
@Rokt33r
Rokt33r / index.php
Created Mar 29, 2014
Laravel 基礎 Lesson 4 - DB (app/views/posts/index.php)
View index.php
<!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){ ?>
@Rokt33r
Rokt33r / show.php
Created Mar 29, 2014
Laravel 基礎 Lesson 4 - DB (app/views/posts/show.php)
View show.php
<!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>
@Rokt33r
Rokt33r / index.blade.php
Last active Aug 29, 2015
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/index.blade.php)
View index.blade.php
@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)
@Rokt33r
Rokt33r / create.blade.php
Created Mar 29, 2014
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/create.blade.php)
View create.blade.php
@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>
@Rokt33r
Rokt33r / show.blade.php
Created Mar 29, 2014
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/show.blade.php)
View show.blade.php
@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')}}
@Rokt33r
Rokt33r / master.blade.php
Created Mar 29, 2014
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/layouts/master.blade.php)
View master.blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
@yield('title')
</title>
</head>
<body>
@yield('body')
@Rokt33r
Rokt33r / routes.php
Created Mar 31, 2014
Laravel 基礎 Lesson 6 - RESTful (app/routes.php)
View routes.php
<?php
Route::get('/', function()
{
return View::make('hello');
});
Route::resource('posts', 'PostController');
You can’t perform that action at this time.