I new to laravel and currently building an application. Now in the application I want to get to the admin index page via via this route: /admin but I end up
here: MyApp.app/admin/
this shows the directory content for admin folder
rather than MyApp.app/admin
which should give me a view in the browser
.
I have added an htaccess file with the following code in it,
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
But it changes nothing.
Here is my route code:
Route::get('admin', ['as'=>'posts.home', 'uses' => 'AdminPostsController@home']);
And my controller code:
public function home(){
//
return view('admin.index');
}
Please note: I initial used a simple code such as:
Rout::get('/admin', function(){ return view('admin.index'});
But I still got the same problem, but accessing the views via route resource works fine. Perhaps there's a standard way of accessing views in `laravel 5.3'.
This app is on my linux computer.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire