jeudi 31 octobre 2019

How to call a file from the route

I wanted to call the file from the route on Laravel. I have a PostsController and inside there was a method name index. I created a folder inside views name posts and inside that created a file named index. I tried to print the variable into the index.blade.php file which i assigned into the PostsController, but got error. Can anyone help me. Here is my code

Route :

Route::post('/posts/index', 'PostsController@index');

Controller : `

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PostsController extends Controller
{
public function index()
{
    $nameIndex = "Testing";

    return view('posts/index',
    [
        'nameIndex' => $nameIndex
    ]);
}
}

` view file : posts/index.blade.php

My name is :



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

Aucun commentaire:

Enregistrer un commentaire