I have a project in laravel that I did a long time ago and I don't remember how to enter the page. It is in the folder: http: // localhost / laravel / Foro_armonicas / This is the routes file: (the entry route is "login"):
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/login', function () {
return view('login');
});
Route::post('validar_login', 'ControllerLogin#validar')->name('validar_login');
Route::get('/registro', function () {
return view('registro');
});
Route::post('guardar_registro', 'ControllerLogin#guardar_registro')->name('guardar_registro');
Route::get('volver', 'ControllerLogin#volver')->name('volver');//este es el de la pagina inicial
Route::get('desconectar', 'ControllerLogin#desconectar')->name('desconectar');
Route::post('/nuevo_post', function () {
return view('nuevo_post');
});
Route::post('controladorNuevoPost', 'ControllerLogin#NuevoPost')->name('controladorNuevoPost');
Route::get('ver_post/{post_id}', 'ControllerLogin#ver_post')->name('ver_post');
Route::post('controladorNuevaRespuesta', 'ControllerLogin#NuevaRespuesta')->name('controladorNuevaRespuesta');
Route::post('controladorGuardarRespuesta', 'ControllerLogin#GuardarRespuesta')->name('controladorGuardarRespuesta');
First you need to install laravel. Then browse to your project folder using Visual code or any other editor of your choice and open the folder.I am assuming you want to run your project on your local machine.
Click on Terminal button on top of your visual code(if you are using visual code).
Type the following code on your terminal:
php artisan serve
Then go to your browser and type
localhost:8000
and you will see your home page.
If you don't do a vhost, the entry point id the public folder :
http://localhost/laravel/Foro_armonicas/public
VHost sample :
<VirtualHost *:80>
ServerName mydomain.ext
DocumentRoot C:/xampp/htdocs/my-laravel/public/
<Directory "C:/xampp/htdocs/my-laravel/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
Related
My route not working on subdomain:
Route::domain('sub.example.com')->middleware(['auth'])->group(function () {
Route::get('/',function(){
return 'Hi!';
});
});
I'm using a shared linux cloud host.
When I visit sub.example.com it runs host default index.php in subdamin's folder!
I can't get my api calls to return any data on ubuntu 16.04.
Here is my method in routes/api.php:
Route::get('comments', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return Comment::all();
});
And this is in RouteServiceProvider:
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
When i hit localhost/api/comments I get 404.
I made sure AllowOverride All is set in my site.conf.
My database has a comments table with data that was populated using artisan seed
Turns out I had all of my api calls setup correctly. I could tell because of php artisan route:list being correct. I also had my apache2 sites setup correctly. The problem ended up being I hadn't setup the correct permissions for my base folder.
Use this command: sudo chmod 755 -R yourprojectbasefolderlocation
i have server from Digital Ocean. I use Serverpilot. How do i domain routing using by laravel 5.3 ?
Rweb example :
Route::group(['domain' => 'admin.developer.app'], function () {
Route::get('/', function () { return view('dash') });
});
Route::group(['domain' => 'department.developer.app'], function () {
Route::get('/', function () { return view('dash') });
});
You need access to DNS zonefile settings at your DNS provider.
Set up a catchall DNS entry (an A record for * pointing to your server address)
Your .htaccess file must be set up correctly that it catches all subdomains and renders developer.app for your routing to work correctly. (I think the default laravel .htaccess is fine)
Add ServerAlias *.developer.app to your VirtualHost config and restart the webserver
I have the following in /var/www/html/blog/routes/web.php
Route::get('/', function () {
return view('welcome');
});
Route::get('test', function () {
return view('test', ['name' => 'Chris']);
});
If I go to http://52.214.14.137 then I see /var/www/html/blog/resources/views/welcome.blade.php.
If I go to If I go to http://52.214.14.137/test then I would expect to see /var/www/html/blog/resources/views/test.blade.php but instead I am seeing a 404.
What am I missing?
I was using Amazon EC2 and the .htaccess file was being ignored by default.
I had to change /etc/httpd/conf/httpd.conf so
AllowOverride None
Become
AllowOverride All
I then restarted Apache with the command below and then Laravel worked perfectly.
sudo service httpd restart
Default route is running
for example:
Route::get('/', function () {
return view('welcome');
});
When i run this http://localhost/laracast/public
Shows outputs as LARAVEL 5
But when I add new route to
Route::get('/hello', function() {
return 'Welcome to Laracast';
});
It shows output as => url not found
I am using
1.Windows7
2.Wamp Server
3.Composer and
4.GIT BASH
what the mistake i done it
If you are changing the default route to /hello, you need to make sure you visit http://localhost/laracast/public/hello in the browser.
If you are just trying to display your own message, change the default route to:
Route::get('/', function() {
return 'Welcome to Laracast';
});
i.e. remove hello from the route and it will correctly display your welcome message when visiting http://localhost/laracast/public