passing data to a view laravel
<p>Just getting to mvc frameworks and im trying to pass data to my view using blade template engine.</p>

<p>here's my routes file</p>

<pre><code>Route::get('/', 'PagesController@index');
</code></pre>

<p>my PagesController</p>

<pre><code>&lt;?php

namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;

class PagesController extends Controller {

    public function index() {

        return view('index');

        $url = 'example.com';
    }

    public function about() {


        return 'hello';


    }

}
</code></pre>

<p>my index.blade.php file</p>

<pre><code>&lt;h1&gt;{{ $url }}&lt;/h1&gt;
</code></pre>

<p>I get the Undefined variable: url error message. What am i doing wrong?</p>