How to change public folder to public_html in Laravel

Quite easy to find this with a simple search. See: https://laracasts.com/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5 In your index.php add the following 3 lines. /* |————————————————————————– | Turn On The Lights |————————————————————————– | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it … Read more

How Can I Remove “public/index.php” in the Laravel Url generated? [duplicate]

Option 1: Use .htaccess If it isn’t already there, create an .htaccess file in the Laravel root directory. Create a .htaccess file your Laravel root directory if it does not exists already. (Normally it is under your public_html folder) Edit the .htaccess file so that it contains the following code: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule … Read more

Where to put the php artisan migrate command

This is how I solved it .Created a bash script called run.sh and added the php artisan migrations commands followed by the php serve command. run.sh #!/bin/sh cd /app php artisan migrate:fresh –seed php artisan serve –host=0.0.0.0 –port=$APP_PORT Added entrypoint to the Dockerfile removing the CMD in the end which will run the commands desired. … Read more

Unit Test Laravel’s FormRequest

I found a good solution on Laracast and added some customization to the mix. The Code /** * Test first_name validation rules * * @return void */ public function test_valid_first_name() { $this->assertTrue($this->validateField(‘first_name’, ‘jon’)); $this->assertTrue($this->validateField(‘first_name’, ‘jo’)); $this->assertFalse($this->validateField(‘first_name’, ‘j’)); $this->assertFalse($this->validateField(‘first_name’, ”)); $this->assertFalse($this->validateField(‘first_name’, ‘1’)); $this->assertFalse($this->validateField(‘first_name’, ‘jon1’)); } /** * Check a field and value against validation rule * … Read more

Laravel quick start guide route not working

Seems like your Laravel app is accesible via an Apache HTTP alias, because your URL looks like: http://localhost/laravel/. If this is the case and assuming that http://localhost/laravel is pointing to your public directory, then follow these steps: Try to navigate to your expected route prepend it with /index.php/, in your case: http://localhost/laravel/index.php/users. If it works … Read more