Posts

How to get the input value after validation failed in laravel 4?

You can get the particular input field after validation failed in laravel 4. simple use the old method with Input class to get the last inserted value of input box. $getvalue = Input::old("fieldName");

How to create a table via Artisan in laravel?

Create a table in database via Artisan in laravel Step1: First you need to go on your root directory Step2: php artisan migrate:make create_users_table paste this code into your command interface Step3: Check the file named 2014_mm_dd_114554_create_users_table.php in your Root\app\database\migrations folder Step4: There will be two method Up and Down paste this Schema in this method  public function up()     {         //         Schema::create('users', function($table)         {             $table->increments('id');             $table->string('email')->unique();             $table->string('name');             $table->timestamps();         });     }     /**      * Reverse the migrations.      *      * @return void      */     public function down()     {         //         Schema::drop('users');     } Step5: Run this command on your root directory php artisan migrate You  can check the database there will a

How to set flash message in laravel?

Set flash message in laravel You need to add this code in your controller Session::flash('loginerror', "Your Email-id or Password does not match."); return Redirect::to('login'); Now you need to add this code in your view section @if (Session::has('loginerror'))    <h2>{{ Session::get('loginerror') }}</h2> @endif

How to check php version in Linux?

How to check php version in Linux or centos simple copy and paste this command to check the php version in your linux window php -i | grep 'PHP Version' Output: PHP Version => 5.5.10

How to set a cron?

Set a cronjob file Please check the details Below  which represent that how can you set a cron job on time basis    .---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr ... | | | | .---- day of week (0 - 6) (Sunday=0 or 7) | | | | | * * * * * command to be executed     Example 1: Set cron job run per minute * * * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 2: Set cron job to run on a specific time every day 5:50am 50 5 * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 3: Set cron job to run on a specific time every day 10:50pm 50 22 * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 4: Set cron job to run on every sunday 1am 00 1 * * 0 /usr/bin/php /var/www/vhosts/site/cron/mycron.php   Example 5: Set cron job to run on every sunday 1am   00 1 * * Sun /usr/bin/php /var/www/vhosts/site/cron

How to print date in linux?

How to print date in linux Simply copy and paste this command in your linux console to print the date -  date '+%A %W %Y %X' Press enter output: Thursday 20 2014 12:29:38 PM You can check more command by write this command on your console date --help

How To install MongoDB in ubuntu?

How To install MongoDB in ubuntu   step1: Open the terminal login with root and copy the given code past in terminal apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo "deb http://downloads-distro. mongodb.org/repo/ubuntu- upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen. list apt-get -y update apt-get -y install mongodb-10gen step2: $ sudo service mongodb start ******************** setup with php *************** step 1: sudo apt-get install php5-dev php5-cli php-pear step2 : sudo pecl install mongo step3: open php.ini "/etc/php5/apache2/php.ini" and set "extension=mongo.so" step4: service apache2 restart Now php with mongodb is ready for work.