Skip to content

2.3 Blade: Example How Tos

Lucas F. Lu edited this page Jan 29, 2020 · 3 revisions

So I have installed this framework. Now what?


1. how to create a view for my home page?

  • Create a file "/resources/views/homepage.blade.php" with the following contents.
@extends('felaraframe::page')
@section('content')
   Home page contents goes here...
@endsection
  • Route to the controller.

under /app/Http/Controllers/MyHomePage.php

...
public function displayHomePage(){
    return view('homepage');
}
...

under /routes/web.php

...
Route::get('homepage','MyHomePage@displayHomePage');
...

2. Now I want to add a file uploader to my home page.

/resources/views/homepage.blade.php

@section('content')
   Home page contents goes here...
<div class="col-md-4">
    @fefileupload(['formID'=>'myFileUploader'])
    @endfefileupload
</div>
@endsection

3. Now I want to load a thirdparty javascript.

/resources/views/homepage.blade.php

@push('footerscripts')
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
@endpush

4. Now I want to add a note control to the right sidebar.

/resources/views/homepage.blade.php

@section('sidebar_alt')
    @fenotes(['active'=>true])
    @endfenotes
@endsection