Category: PHP

PHP articles.

15 Awesome Laravel collection methods

15 Awesome Laravel collection methods

Laravel Eloquent uses Collections to return the results. Collections contains very useful methods that makes them very powerful and helpful to use. You can filter them, modify them and much more with them very conveniently. We will be looking at...

/ April 25, 2018
Laravel login with email or username

Laravel Auth: Login With Email Or Username In One Field

A quick great tip for you guys. Laravel default authentication allows you to login with an email only but we can also use some other field like username. Laravel by default only allows one field email for login but we...

/ April 14, 2018
Using underscore translation laravel

Laravel Underscores __() Function for localization based Translations

Laravel has a great helper function underscores (__) that we can use for JSON-based translations. Laravel 5.6 default authentication blade files also make use of underscore helper function. Like this: {{ __('Register') }} In previous versions of Laravel, we used...

/ April 12, 2018
PHP make migration parameters

make migration artisan command parameters in laravel

A quick little tip for guys who are new to Laravel. The artisan command make:migration accepts optional parameters -create and -table. These parameters allows you to change generate stubs created with the migration file. Let’s check out the differences. Simple...

/ April 9, 2018
Testing file uploads with Laravel

Testing File Uploads with Laravel

In this tutorial, we will see how we can test file uploads with laravel. We will create a very simple form to upload the file. Furthermore, we will test file uploads using laravel. Create a new View Let’s start by...

/ April 4, 2018
Laravel database seeding

Laravel migration with database seeding

In this tutorial, we will learn how to use laravel migrations and seeders for them. Laravel provides great functionality to create migrations which are the schema for the database. Laravel also provides the functionality to create fake data through fzaninotto/faker...

/ March 31, 2018
loop variable in foreach in Laravel

Using the $loop variable in foreach loops in Laravel

Laravel blade has a foreach directive that we can use the same way as we use the foreach loop in PHP. @foreach directive is more powerful than a normal foreach loop because of the $loop variable that is available inside every...

/ March 29, 2018
CSRF protection in Laravel

Laravel: How to Avoid TokenMismatchException CSRF Token on certain routes using a method

If you stay on one form for too long or you are using some third-party APIs, you get TokenMismatchException. Therefore, you want to get rid of CSRF protection for certain routes. Removing middleware Now, there are a lot of options....

/ March 28, 2018
redirectTo after login/registration

Redirect after login or register in Laravel: Adding a custom method

Laravel built-in authentication system has a $redirectTo property that you can use to customize where the user will be redirected after successful login/registration. But we can customize even more than that. By default, app/Http/Controllers/Auth/RegisterController.php has the $redirectTo property. class RegisterController extends Controller...

/ March 27, 2018
Best PHP Frameworks

Top 10 best PHP Frameworks for Developers

An overview of the Top 10 best PHP frameworks for web development to find out how to make your workflow faster and easier. Introduction PHP is a popular server-side scripting language designed primarily for the web development. Originally created by...

/ March 21, 2018