How to get different between two dates in Laravel Framework

By using Carbon library in Laravel, We can easily grab the details between 2 dates.

$to = \Carbon\Carbon::now();

$from = \Carbon\Carbon::createFromFormat(‘Y-m-d H:i:s’, ‘2018-05-14 14:21:53’);

$diff_in_days = $to->diffInDays($from);

dd($diff_in_days);

– Laravelcode

Advertisements

Laravel mysql migrate error

If you found error something like below while doing migration,

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' (SQL: select * from information_schema.tables where table_schema = fisica and table_name = migrations)

In the config/database.php, Add My MySQL array ended up like this:

'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
'modes' => [
'ONLY_FULL_GROUP_BY',
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ENGINE_SUBSTITUTION',
],
],

Then, it works like a charm.

Currency Converter Help Of Yahoo API

Some time you need to convert currency into another currency like USD to EUR, Ruppe to USD. so, you can done this by yahoo API yes yahoo provide to programmer to open source API for any currency convert to another currency
Simple make one function and write following code in your function.

Continue reading “Currency Converter Help Of Yahoo API”

Web development technologies you can learn in 2018

For many, the path goes through learning fundamentals like HTML, CSS and Javascript. After mastering the basics many aspiring engineers will dive deeper into object oriented Javascript, ES6, Angular, Node, React.js, Vue.js and more.

We can build anything with javascript. But In this post I’d like to offer up some alternative technologies.

#1 — Laravel

Laravel is an open source PHP web development framework for building quality apps quickly. This is a very powerful programming framework with elegant way of syntaxes.

#2 — Object Oriented PHP

Yes Javascript is the new hottness but PHP still runs about 80% of the internet. Massive companies like Facebook, Slack and Wikipedia all run PHP at scale. For getting started in web development, PHP is an obvious choice that not many people think about. For whatever reason, only one bootcamp that I know of out of dozens in the Bay Area teaches PHP as part of their curriculum.

Continue reading “Web development technologies you can learn in 2018”