jcadima
1/15/2017 - 3:22 PM

Simple Laravel Routes and Views

Simple Laravel Routes and Views

<?php
Controllers Location:
    app/Http/Controllers/

Views Location:
    resources/views

Routes Location:
    routes/web.php


################ app/Http/Controllers/GalleryController ####################

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class GalleryController extends Controller
{
    // List Galleries
    public function index() {
    	//die('Gallery/Index') ;
    	$test = 'TESTING' ;
    	return view('gallery/index', compact('test') ) ;
    }

    // Show Create Form
    public function create() {
    	die('Gallery/create') ;
    }

    // Store Gallery
    public function store(Request $request) {

    }

    // Show Gallery Photos
    public function show($id) {
    	die($id) ;
    }



}




############### resources/views/main.blade.php #####################

-------------- main.blade.php  - START ----------------------<br>

// this is where the main html template would go
// Header, Footer, Sidebar
@yield('content')


<br>-------------- main.blade.php - END -----------------------


############### resources/views/index.blade.php #####################

@extends('layouts.main')


@section('content')
   // in this section only the part specific to this template
	index.blade.php
	<br>
	Printing variable $test from controller: {{$test}}

@stop