8. 小例子,实现一个简单的blog之select

1. 注册路由

Route::get('articles', 'ArticlesController@index');
Route::get('articles/{id}', 'ArticlesController@show');

2. 创建ArticlesController类

  php artisan make:controller ArticlesController
8. 小例子,实现一个简单的blog之select_第1张图片
App\Http\Controllers\ArticlesController.php

3. 视图层view

8. 小例子,实现一个简单的blog之select_第2张图片
resources/views

resources/views/articles/index.blade.php

@extends('app')

@section('content')
    

Articles


@foreach($articles as $article)

{{ $article->title }}

{{ $article->body }}
@endforeach @stop

resources/views/articles/show.blade.php

@extends('app')

@section('content')
    

{{ $article->title }}


{{ $article->body }}
@stop

你可能感兴趣的:(8. 小例子,实现一个简单的blog之select)