コード例 #1
0
 protected function ridersSeeder()
 {
     Rider::updateOrCreate(['no' => '99', 'name' => 'Jorge Lorenzo']);
     Rider::updateOrCreate(['no' => '46', 'name' => 'Valentino Rossi']);
     Rider::updateOrCreate(['no' => '93', 'name' => 'Marc Márquez']);
     Rider::updateOrCreate(['no' => '26', 'name' => 'Dani Pedrosa']);
 }
コード例 #2
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Rider;
Route::get('/', function () {
    return view('welcome');
});
Route::get('/riders/{no}', function ($no) {
    $no = (int) $no;
    return Rider::where('no', $no)->first(['no', 'name']);
});