1. Information
-
See http://codebright.daylerees.com/code-bright for documentation.
-
See http://weblogs.asp.net/fbouma/soft-deletes-are-bad-m-kay.
-
Note: Note that we do not tell Eloquent which table to use for our User model. The lower-case, plural name of the class will be used as the table name unless another name is explicitly specified. So, in this case, Eloquent will assume the User model stores records in the users table.
2. Installation
Installation of Laravel 5:
-
Install XAMPP.
-
Install Composer.
-
Log in as <user>.
-
Start Terminal.
composer global require laravel/installer
-
Setup XAMPP to work with Laravel.
-
Edit the php.ini file. (see YouTube video at 16 min).
cd sudo apt-cache search php7 sudo apt-get install php7.#-mbstring sudo apt-get install php7.#-xml sudo apt-get install php7.#-zip sudo apt-get install tree composer global require "laravel/installer" echo PATH=\$PATH:$HOME/.composer/vendor/bin >> $HOME/.bashrc ? echo PATH=\$PATH:$HOME/.composer/vendor/bin >> /etc/bash.bashrc source $HOME/.bashrc ? source /etc/bash.bashrc which laravel laravel --version laravel new <project> tree <project> vdir <project> cd <project> php artisan serve
-
Browse to http://localhost:8000.
sudo ln -s `pwd`/smru-anc-application/src /var/www/html/anc-app sudo ln -s $HOME/<project>/public /var/www/html/laravel sudo /etc/init.d/apache2 restart # Optional
-
Browse to http://localhost/laravel.
? sudo chown $USER:$USER $HOME/<project>/storage ? sudo chown -R $USER:$USER $HOME/<project>/storage ? sudo chown $USER:$USER $HOME/<project>/bootstrap/cache ? sudo chown -R $USER:$USER $HOME/<project>/bootstrap/cache
-
Type
composer create-project laravel/laravel laravel-5 dev-developand press Enter. -
Close Terminal.
3. Installation of Laravel 4
-
Install Composer.
-
Log in as delta.
sudo apt-get install php5-mcrypt sudo service apache2 restart sudo composer self-update mkdir -p ~delta/github/git/delta-software-labs cd ~delta/github/git/delta-software-labs composer create-project laravel/laravel ANC-Application --prefer-dist * ..... cd ~delta/github/git/delta-software-labs/ANC-Application # Optional. composer install composer update sudo useradd --shell /bin/false --system --uid 900 web sudo gpasswd -a delta web sudo gpasswd -a www-data web sudo chgrp -R web app/storage sudo chmod -R g+rw app/storage sudo cp -a /etc/apache2/sites-available/default /etc/apache2/sites-available/laravel diff /etc/apache2/sites-available/default /etc/apache2/sites-available/laravel
+
0a1,2 > Alias /ANC-Application /home/delta/github/git/delta-software-labs/ANC-Application/public > 2a5,6 > ServerName laravel > ServerAlias www.laravel 4c8 < DocumentRoot /var/www --- > DocumentRoot /home/delta/github/git/delta-software-labs/ANC-Application/public
+
sudo a2ensite laravel sudo service apache2 restart
-
Append the following lines to the /etc/hosts file?
#Virtual Hosts 12.34.56.789 example.com
-
Note: Clashes with other web sites.
-
Contents of the /etc/apache2/conf.d/laravel.conf file.
Alias /ANC-Application "/home/delta/github/git/delta-software-labs/ANC-Application/public" <VirtualHost *:80> # Host that will serve this project. ServerName app.dev # The location of our projects public directory. DocumentRoot /home/delta/github/git/delta-software-labs/ANC-Application/public # Useful logs for debug. CustomLog /var/log/apache2/laravel-access.log common ErrorLog /var/log/apache2/laravel-error.log # Rewrites for pretty URLs, better not to rely on .htaccess. <Directory /home/delta/github/git/delta-software-labs/ANC-Application/public> <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> </VirtualHost>? sudo a2enmod rewrite sudo service apache2 restart
4. Configuration of Laravel 4
-
Log in as user.
sudo cp -a app/config/app.php app/config/app.php.orig sudo cp -a app/config/database.php app/config/database.php.orig # Set the timezone value in the application.php file to 'Asia/Bangkok'. sudo php artisan key:generate
-
Make the following changes to the database.php file.
'default' => 'pgsql', 'pgsql' => array( 'driver' => 'pgsql', 'host' => '127.0.0.1', 'host' => 'localhost, 'database' => 'laravel', 'username' => 'delta', 'password' => '********', 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ), -
Close Terminal.
git clone https://github.com/laravel/laravel.git ANC-Application cd ANC-Application composer install # Use built-in server of PHP 5.4: php -v php -S localhost:8888 -t public
-
Browse to http://localhost:8888.
-
Download the latest development version from http://four.laravel.com.
cd /opt sudo unzip ~/Downloads/laravel-develop.zip sudo rm -rf laravel sudo ln -s laravel-develop laravel sudo ln -s /opt/laravel/public /var/www/laravel vdir cd /opt/laravel ? Type [kbd]`sudo chown -R www-data:www-data app/storage/* sudo composer install sudo cp -a app/config/app.php app/config/app.php.orig sudo cp -a app/config/database.php app/config/database.php.orig # Set the timezone value in the application.php file to 'Asia/Bangkok'. sudo php artisan key:generate
-
Make the following changes to the database.php file.
'default' => 'pgsql', 'pgsql' => array( 'driver' => 'pgsql', 'host' => '127.0.0.1', 'database' => 'laravel', 'username' => 'delta', 'password' => '********', 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ), -
Browse to http://localhost/laravel.
5. Installation of Laravel 3
-
Log in as user.
-
Download the latest stable version from laravel.com.
sudo apt-get install php5-mcrypt sudo service apache2 restart cd /opt sudo unzip ~/Downloads/laravel-laravel-v3.2.13-5-g23d23dd.zip sudo find laravel-laravel-23d23dd -type d -exec chmod a+rx {} \; sudo rm -rf laravel sudo ln -s laravel-laravel-23d23dd laravel sudo ln -s /opt/laravel/public /var/www/laravel vdir cd /opt/laravel sudo chown -R www-data:www-data storage/views cd /opt/laravel/application/config sudo cp -a application.php application.php.orig sudo cp -a database.php database.php.orig # Set the timezone value in the application.php file to 'Asia/Bangkok'. # Set the key value in the application.php file to an empty string. cd /opt/laravel sudo php artisan key:generate -
Make the following changes to the database.php file.
'default' => 'pgsql', 'pgsql' => array( 'driver' => 'pgsql', 'host' => '127.0.0.1', 'database' => 'laravel', 'username' => 'delta', 'password' => '********', 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ), -
Browse to http://localhost/laravel.
-
See http://net.tutsplus.com/tutorials/php/building-web-applications-from-scratch-with-laravel.
-
Type
cd /etc/apache2/sites-availableand press Enter. -
Contents of the xxx file.
<VirtualHost *:80> ServerAdmin username@gmail.com DocumentRoot /var/www/laravel/public ServerName www.site1.com ServerAlias site1.com </VirtualHost> -
Note: Douwe: Is the following really needed?
-
Type
sudo cp -a /etc/apache2/sites-available/default /etc/apache2/sites-available/default.origand press Enter. -
Type
sudo cp -a /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.origand press Enter. -
Change AllowOverride None to AllowOverride All in the <Directory /var/www> section of the /etc/apache2/sites-available/default and /etc/apache2/sites-available/default-ssl files.
-
Type
sudo service apache2 restartand press Enter. -
Close Terminal.
6. Experimental
-
Install Composer.
-
Log in as user.
-
Download the latest validation version from https://github.com/illuminate/validation.
cd /opt sudo unzip ~/Downloads/validation-master.zip cd validation-master sudo composer install
Production way, moderate complexity for people not familiar with unixes, but more secure:
Go in super user mode (sudo -s or su). Create group web (groupadd web) Add you main user to group web (suppose your user is cool_user, so run usermod -a -G web cool_user) Add php-fpm or web server user (is php used as SAPI module) to web group (for example, on centos php-fpm utilize apache user name, so in most cases this will work: usermod -a -G web apache) Change your project root directory group owner to web recursively (chgroup -R web /path/to/project/root/) Grant recursively write permission for group (chmod -R g+w /path/to/project/root/ Optionaly To allow all newly created by apace (or some other) user files and folders be accessible from your user, make them receive group ownership same as their parent folder by setting groupid bit recursively on your project root directory (chmod -R g+s /path/to/project/root/).
Voila!.