Sending mail with Laravel

,

Postfix

If you use Postfix on your server you have to change  config > mail.php

// ‘driver’ => ‘smtp’,
‘driver’ => ‘sendmail’,

Install Postfix: http://www.codechewing.com/library/set-up-postfix-on-ubuntu-server/

https://help.ubuntu.com/14.04/serverguide/postfix.html

useful:

https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mysql

Configure Postfix to Use Gmail SMTP on Ubuntu https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/

 

Smtp

http://www.havetheknowhow.com/Configure-the-server/Install-ssmtp.html

 

[php snippet=1]

Laravel project installation

I got this error:  “Mcrypt PHP extension required. ”

Solution:
$: sudo php5enmod mcrypt

$: sudo /etc/init.d/apache2 restart

source:
http://askubuntu.com/questions/460837/mcrypt-extension-is-missing-in-14-04-server-for-mysql

Error in exception handler: The stream or file “…/storage/logs/laravel.log” could not be opened: failed to open stream

Solution:

$: sudo chmod 777 /var/…/storage –R

$: sudo chmod 777 /var/…. /uploads –R

 

 

Advanced Routing and Filters in Laravel

I think you are interested in more than Basic Routing, let’s go deeper into routing concept in Laravel framework. In this tutorial we will check Route filters, Named Routes and Route Groups in detail.

Let’s take a look at how you can achieve an URL in laravel even though your route is something else. Suppose you want to achieve an SEO URL as http:://domain.com/profile but your route is some thing like this user/profile. But you don’t need to worry you can achieve what ever URL you want using named routes concept in routing like below.

source: http://kodeinfo.com/post/advanced-routing-and-filters-in-laravel?sthash.cHPqXzTE.mjjo

Laravel 4 on Shared Host

Place the files of the Laravel public folder i.e. css, img, js etc; into public_html folder.

Put all the remaining folders & files into another folder, say ‘laravelcore’ and place the laravelcore folder in the root

Open index.php in the public_html folder and replace the following lines as mentioned

require DIR.’/../bootstrap/autoload.php’;

require __DIR__.'/../laravelcore/bootstrap/autoload.php';

$app = require_once DIR.’/../bootstrap/start.php’;

$app = require_once __DIR__.'/../laravelcore/bootstrap/start.php';

Open paths.php file in laravelcore/bootstrap and replace the following line

‘public’ => DIR.’/../public’,

'public' => __DIR__.'/../../public_html',

source: http://blog.laravel.in/how-to-setup-laravel-shared-hosts/

************
Update:

Move everything from public folder to root folder.

In index.php:

require __DIR__.'/bootstrap/autoload.php';

$app = require_once __DIR__.'/bootstrap/start.php';

bootstrap/paths.php:

'public' => __DIR__.'/..',

This is also interesting:

Having problems installing Laravel on shared hosting? A few pointers

confirm popup in the url

onclick="if(!confirm('Are you sure to delete this item?')){return false;};"
<a href="{{ route('delete/item', $my_item->product_id) }}" onclick="if(!confirm('Are you sure to delete this item?')){return false;};" >Delete</a>

Dynamic Layout in Laravel

BaseController:

class BaseController extends Controller {

/**
* Setup the layout used by the controller.
*
* @return void
*/

/*Set a layout properties here, so you can globally
call it in all of your Controllers*/
protected $layout = ‘layouts.default’;

protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = View::make($this->layout);
}
}

}


class HomeController extends BaseController {

public function showHome()
{
/*now you can control your Layout it here */
$this->layout->title= “Hi I am a title”; //add a dynamic title
$this->layout->content = View::make(‘home’);
}

}

 

source: http://teknosains.com/i/tutorial-dynamic-layout-in-laravel-4

Mcrypt PHP extension required.

,

You know:
The Laravel framework has a few system requirements:PHP >= 5.4, MCrypt PHP Extension

I got this error after deployment to the server: “Mcrypt PHP extension required.”

Solution:

sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart