Skip to content

Instantly share code, notes, and snippets.

View Rokt33r's full-sized avatar
🧨
BOOM!

Junyoung Choi Rokt33r

🧨
BOOM!
View GitHub Profile
@Rokt33r
Rokt33r / routes.php
Last active August 29, 2015 13:57
Laravel 基礎 Lesson 4 - DB (app/routes.php)
<?php
Route::get('/', function()
{
return View::make('hello');
});
// 投稿formを表示する
Route::get('posts/create', 'PostController@create');
@Rokt33r
Rokt33r / PostController.php
Created March 29, 2014 17:13
Laravel 基礎 Lesson 4 - DB (app/controllers/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 March 29, 2014 17:14
Laravel 基礎 Lesson 4 - DB (app/views/posts/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 March 29, 2014 17:14
Laravel 基礎 Lesson 4 - DB (app/views/posts/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 March 29, 2014 17:15
Laravel 基礎 Lesson 4 - DB (app/views/posts/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 August 29, 2015 13:57
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/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 March 29, 2014 19:54
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/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 March 29, 2014 19:55
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/posts/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 March 29, 2014 19:56
Laravel 基礎 Lesson 5 - Blade & Helper (app/views/layouts/master.blade.php)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
@yield('title')
</title>
</head>
<body>
@yield('body')
@Rokt33r
Rokt33r / routes.php
Created March 31, 2014 06:28
Laravel 基礎 Lesson 6 - RESTful (app/routes.php)
<?php
Route::get('/', function()
{
return View::make('hello');
});
Route::resource('posts', 'PostController');