Minggu, 30 April 2017

POST AJAX JQUERY LARAVEL Request

This is the Ajax .
<script >
var productChecked = $.ajax({
                        method : 'POST',
                        url: '../../checkout',
                        async: false,
                        dataType: 'json',
                        data : { 'brand' :brand,
                                  'category' : category
                                   }
                    }).responseText;

                    console.log(productChecked);
</script>

responseText will tell us if there is error message with making error message our selves 

Rabu, 19 April 2017

Host Name/Variable Database Configuration

Database name can be 127.0.0.1 , localhost , IP Address , DNS. we can try one of  those to set database host variable.

Sabtu, 15 April 2017

Using NGINX Server

Restart Server After any configuration :
systemctl restart nginx

check nginx.conf
nginx -t

Server Configuration located :

/etc/nginx/conf.d/default.conf

Kamis, 13 April 2017

Better Error Messages in Laravel for Easier Debugging

Whoops Error Message
- Open command Line
- change directory into your laravel project  and type :
composer require filp/whoops

- Copy this code in your App\Exceptions\Handler.php

/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
return response()->make(
$whoops->handleException($e),
method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500,
method_exists($e, 'getHeaders') ? $e->getHeaders() : []
);
}
return parent::convertExceptionToResponse($e);
}