Foros del Web » Programando para Internet » PHP » Frameworks y PHP orientado a objetos »

[SOLUCIONADO] error creando proyecto con laravel

Estas en el tema de error creando proyecto con laravel en el foro de Frameworks y PHP orientado a objetos en Foros del Web. hola amigos espero me puedan ayudar ya que apenas inicio con laravel y para entenderlo mejor estoy siguiendo este tutorial http://fideloper.com/laravel-4-uber-...ith-auth-guide 1 Cree el proyecto ...
  #1 (permalink)  
Antiguo 18/07/2013, 12:54
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
error creando proyecto con laravel

hola amigos espero me puedan ayudar ya que apenas inicio con laravel y para entenderlo mejor estoy siguiendo este tutorial http://fideloper.com/laravel-4-uber-...ith-auth-guide

1 Cree el proyecto

Código BASH:
Ver original
  1. composer create-project laravel/laravel montes


2 Hice la migraciòn
Código BASH:
Ver original
  1. php artisan migrate:make create_users_table --table=users --create

3 edite el modelo app/models/User.php y asi quedo
Código PHP:
Ver original
  1. use Illuminate\Auth\UserInterface;
  2. use Illuminate\Auth\Reminders\RemindableInterface;
  3.  
  4. class User extends Eloquent implements UserInterface, RemindableInterface {
  5.  
  6.     /**
  7.      * The database table used by the model.
  8.      *
  9.      * @var string
  10.      */
  11.     protected $table = 'users';
  12.  
  13.     /**
  14.      * The attributes excluded from the model's JSON form.
  15.      *
  16.      * @var array
  17.      */
  18.     protected $hidden = array('password');
  19.  
  20.  
  21.  
  22.     protected $fillable = array('email', 'password');
  23.  
  24.     /**
  25.      * Get the unique identifier for the user.
  26.      *
  27.      * @return mixed
  28.      */
  29.     public function getAuthIdentifier()
  30.     {
  31.         return $this->getKey();
  32.     }
  33.  
  34.     /**
  35.      * Get the password for the user.
  36.      *
  37.      * @return string
  38.      */
  39.     public function getAuthPassword()
  40.     {
  41.         return $this->password;
  42.     }
  43.  
  44.     /**
  45.      * Get the e-mail address where password reminders are sent.
  46.      *
  47.      * @return string
  48.      */
  49.     public function getReminderEmail()
  50.     {
  51.         return $this->email;
  52.     }
  53.  
  54. }

4 edite la migracion app/database/migrations/2013_07_18_182811_create_users_table.php

Código PHP:
Ver original
  1. <?php
  2.  
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5.  
  6. class CreateUsersTable extends Migration {
  7.  
  8.     /**
  9.      * Run the migrations.
  10.      *
  11.      * @return void
  12.      */
  13.     public function up()
  14.     {
  15.         Schema::create('users', function(Blueprint $table)
  16.         {
  17.             $table->increments('id');
  18.             $table->string('email')->unique();
  19.             $table->string('password');
  20.             $table->timestamps();
  21.         });
  22.     }
  23.  
  24.     /**
  25.      * Reverse the migrations.
  26.      *
  27.      * @return void
  28.      */
  29.     public function down()
  30.     {
  31.         Schema::drop('users');
  32.     }
  33.  
  34. }

5 edite app/database/seeds/DatabaseSeeder.php
Código PHP:
Ver original
  1. <?php
  2.  
  3. class DatabaseSeeder extends Seeder {
  4.  
  5.     /**
  6.      * Run the database seeds.
  7.      *
  8.      * @return void
  9.      */
  10.     public function run()
  11.     {
  12.         Eloquent::unguard();
  13.  
  14.         $this->call('UserTableSeeder');
  15.     }
  16.  
  17. }

6 Cree el UserTableSeeder.php en app/database/seeds/

Código PHP:
Ver original
  1. <?php
  2.  
  3. class UserTableSeeder extends Seeder {
  4.  
  5.     public function run()
  6.     {
  7.         DB::table('users')->delete();
  8.  
  9.         User::create(array(
  10.             'email' => '[email protected]',
  11.             'password' => Hash::make('your_password')
  12.         ));
  13.     }
  14. }

7 cree la base de datos php artisan migrate --env=local.....

8

segui todos los pasos y cuando compruebo en el navegador http://localhost/montes/public/login

y obtengo este error

Cita:
Not Found

The requested URL /montes/public/login was not found on this server.
  #2 (permalink)  
Antiguo 18/07/2013, 13:00
 
Fecha de Ingreso: junio-2013
Ubicación: Madrid
Mensajes: 73
Antigüedad: 10 años, 10 meses
Puntos: 27
Respuesta: error creando proyecto con laravel

¿ Editaste el app/routes.php ?

¿ Tienes en el htaccess la línea

Rewritebase /montes/public/

?
  #3 (permalink)  
Antiguo 18/07/2013, 13:12
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: error creando proyecto con laravel

eternoaprendiz gracias por responder

el app/routes.php me quedo asi
Código PHP:
Ver original
  1. <?php
  2.  
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Application Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register all of the routes for an application.
  9. | It's a breeze. Simply tell Laravel the URIs it should respond to
  10. | and give it the Closure to execute when that URI is requested.
  11. |
  12. */
  13.  
  14. Route::get('/', array('before' => 'auth' ,function()
  15. {
  16.     return 'Hello, '.Auth::user()->email.'!';
  17. }));
  18.  
  19. Route::get('/login', function()
  20. {
  21.     return View::make('login');
  22. });
  23.  
  24. Route::post('/login', function()
  25. {
  26.     // Validation? Not in my quickstart!
  27.     // No, but really, I'm a bad person for leaving that out
  28.     Auth::attempt( array('email' => Input::get('email'), 'password' => Input::get('password')) );
  29.  
  30.     return Redirect::to('/');
  31. });

y el archivo htaccess no lo veo por ningun lado o lo tengo que crear?
  #4 (permalink)  
Antiguo 18/07/2013, 13:53
 
Fecha de Ingreso: junio-2013
Ubicación: Madrid
Mensajes: 73
Antigüedad: 10 años, 10 meses
Puntos: 27
Respuesta: error creando proyecto con laravel

Debería estar en la carpeta public, como se puede ver en github:

https://github.com/laravel/laravel/blob/master/public/.htaccess
  #5 (permalink)  
Antiguo 18/07/2013, 14:14
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: error creando proyecto con laravel

eternoaprendiz gracias por responder

estoy utilizando Centos 6 y intente crear el archivo .htaccess en public y parece que ya esta obtengo esto Ya existe un archivo llamado «.htaccess». ¿Quiere reemplazarlo? El archivo ya existe en «public». Si lo reemplaza sobreescribirá su contenido.

por consola lo abri y lo edite

asi estaba el archivo
Código BASH:
Ver original
  1. # vi .htaccess

Cita:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
y asi quedo

Cita:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
y comprobe de nuevo http://localhost/montes/public/login

y obtengo el mismo error

Cita:
Not Found

The requested URL /montes/public/login was not found on this server.
Apache/2.2.15 (CentOS) Server at localhost Port 80
  #6 (permalink)  
Antiguo 18/07/2013, 15:06
 
Fecha de Ingreso: junio-2013
Ubicación: Madrid
Mensajes: 73
Antigüedad: 10 años, 10 meses
Puntos: 27
Respuesta: error creando proyecto con laravel

¿ Tienes en el htaccess la línea

Rewritebase /montes/public/

?

http://randomtype.ca/blog/the-wordpress-htaccess-file-explained/
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

No te respondo más a esto.
  #7 (permalink)  
Antiguo 18/07/2013, 15:38
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: error creando proyecto con laravel

eternoaprendiz

Cita:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
Rewritebase /montes/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
y sigue sin funcionar , no se que mas hacerle .
  #8 (permalink)  
Antiguo 19/07/2013, 10:12
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: error creando proyecto con laravel

eternoaprendiz tenias toda la razon , me funciono como me indicaste

Cita:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
Rewritebase /montes/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
  #9 (permalink)  
Antiguo 19/07/2013, 11:53
 
Fecha de Ingreso: junio-2013
Ubicación: Madrid
Mensajes: 73
Antigüedad: 10 años, 10 meses
Puntos: 27
Respuesta: error creando proyecto con laravel

¡Me alegro!

Etiquetas: creando, php, proyecto
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:24.