lundi 6 février 2017

What is the reason: Undefined variable in laravel 5

Hello I am new to Laravel and working on my first project using Laravel 5. I am getting this error when i pass the data from controller to view. I am stuck last three days. I have checked all questions from online blogs , even stackoverflow but couldn't find the solution please help. Here is my code

App\Routes\web.php

Route::get('/list', 'CustomerController@list');

App\Http\Controllers\CustomerController.php

public function list(){

    $first = 'Mian';
    $last = 'Amir';
    $fullName = $first . " " . $last;
    //dd($fullName);
    return view('new')->with("fullName", $fullName);
    //return view('new')->withFullName($fullName);
   }

Resources\Views\new.blade.php

@extends('master')

@section('content')

<h1>New Content Will Goes Here: </h1>


@endsection


I have also tried these also:

     //return view('new')->with('customer', $customers);
    //return View::make('new')->with(array('customers' => $customers));
   // return View::make('new', compact('customers'));
   /$customers = DB::table('customers')->get();

  //return view('new', ['customers' => $customers]);
  //return View::make('new', compact('customers'));
   //return View::make('new')->with('customers', $customers);
  //dd($customers);
  //return View::make('new')->with(array('customers' => , $customers));

  //$customers = Customer::all();
  //dd($customers);
  //return View::make('view')->with('customers', $customers);
  //return View::make('view', compact('customers'));
  //return $view->with('customers', $customers)->with('q', $q);
  //return view('view', ['key' => 'The big brown fox jumped over the lazdog']);
  //$key = 'If a would chuck can chuck wood,';
  //return view('view', compact('key'));



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kJwu3J
via IFTTT

Aucun commentaire:

Enregistrer un commentaire