Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Database configuration file is located at
config/database.php
by Valeri Tandilashvili
4 years ago
0
Laravel
Laravel From Scratch
0
Visiting
/hello
page returns text
Hello World
Route::get('/hello', function () {
    return 'Hello World';
});
by Valeri Tandilashvili
4 years ago
0
Laravel
routes
Laravel From Scratch
0
Visiting
/hello
page returns
<h1>
Route::get('/hello', function () {
    return '<h1>Hello World</h1>';
});
by Valeri Tandilashvili
4 years ago
0
Laravel
routes
Laravel From Scratch
0
Returns view located at
resources/views/pages/about.blade.php
Route::get('/hello', function () {
    return view('pages/about');
});
pages/about
is the same as
pages.about
by Valeri Tandilashvili
4 years ago
0
Laravel
routes
Laravel From Scratch
0
Returns text with the user name passed through request URL
Route::get('/users/{name}', function ($name) {
    return 'This is a user ' . $name;
});
Two parameters passed through the request URL
Route::get('/users/{name}/{id}', function ($name, $id) {
    return 'This is a user ' . $name .' with an id of '. $id;
});
by Valeri Tandilashvili
4 years ago
0
Laravel
routes
Laravel From Scratch
0
Only
about
returns view from route. Other routes fire
PagesController
appropriate methods
Route::get('/', 'PagesController@index');

Route::get('/about', function () {
    return view('pages.about');
});

Route::get('/services', 'PagesController@services');
Route::get('/contact', 'PagesController@contactUs');
PagesController
methods
class PagesController extends Controller
{
    public function index() {
        return view('pages.index');
    }
    public function about() {
        return view('pages/about');
    }
    public function services() {
        return view('pages/services');
    }
    public function contactUs() {
        return 'Under Construction';
    }
}
by Valeri Tandilashvili
4 years ago
0
Laravel
routes
Laravel From Scratch
0
@yield
is mainly used to define a section in a layout. Content of
resources/views/layouts/app.blade.php
file
<body>
     @yield('content')
</body>
Content of
about
page that extends the above layout file
@extends('layouts.app')

@section('content')
     // "about us" page content goes here
@endsection
by Valeri Tandilashvili
4 years ago
0
Laravel
blade template
Laravel From Scratch
0
@extends
Extends layout file located at
resurces/views/layouts/app.blade.php
@extends('layouts.app')

@section('content')
     // "about us" page content goes here
@endsection
by Valeri Tandilashvili
4 years ago
0
Laravel
blade template
0
Pass parameter from controller to view
public function about() {
        $param1 = 'this is a parameter of about us page';
        return view('pages/about', compact('param1'));
    }
Content of
about
blade (the page receives and uses the passed parameter)
@section('cntnt')
    <h3>abt us {{$param1}}</h3>
@endsection
by Valeri Tandilashvili
4 years ago
0
Laravel
blade template
Laravel From Scratch
0
public function services() {
        $data = [
            'title' => 'langs',
            'languages' => ['PHP', 'Java', 'Python']
        ];
        return view('pages/services')->with($data);
}
Receive the passed array
@extends('layouts.app')

@section('cntnt')
    <h3>{{$title}}</h3>
    @if(count($languages))
        @foreach($languages as $language)
            <li>{{$language}}</li>
        @endforeach
    @endif
@endsection
by Valeri Tandilashvili
4 years ago
0
Laravel
blade template
Laravel From Scratch
0
Results: 1580