The Laravel Handbook
first retrieve the data from the model, and pass it to the view. First we import the model at the top of the file: use App\Models\Dog; Then in the route we call Dog::all(); to get all the dogs stored 65 Now we scaffold the Dog model: php artisan make:model Dog Go to routes/web.php . At the top, add use App\Models\Dog; then find the / route: Route::get('/', function () { return view('welcome'); t; class DogController extends Controller { // } Add use App\Models\Dog; at the top, and add those 2 methods to the class, create and delete , as we did before, but this time both0 码力 | 111 页 | 14.25 MB | 1 年前3Laravel 3.2 Documentation
=> 'bar'); return Response::make('Hello World!', 200, $headers); }); Returning a custom response containing a view, with binding data: return Response::view('home', array('foo' => 'bar')); make development changes to Laravel. Right-click the Laravel directory to bring up the context menu. Click on Git Clone... Git clone Url: https://github.com/laravel/laravel.git Directory:0 码力 | 139 页 | 1.13 MB | 1 年前3Laravel 5.0 Documentation
file to pagination::slider-3 . If app/controllers/BaseController.php has a use statement at the top, change use Illuminate\Routing\Controllers\Controller; to use Illuminate\Routing\Controller; . return 'Hello World'; }); Route::post('foo/bar', function() { return 'Hello World'; }); Route::put('foo/bar', function() { // }); Route::delete('foo/bar', function() { // }); Route::match(['get' with the _method field will be used as the HTTP request method. For example:
共 13 条
- 1
- 2