Learn about my progress!
ACID properties are an important concept for databases. The acronym stands for Atomicity, Consistency, Isolation, and Durability.
The ACID properties of a DBMS allow safe sharing of data. Without these ACID properties, everyday occurrences such using computer systems to buy products would be difficult and the potential for inaccuracy would be huge. Imagine more than one person trying to buy the...
Stripe Integration in Laravel
Stripe is a US technology company, operating in over 25 countries, that allows both private individuals and businesses to accept payments over the Internet.
For integrating Stripe in Laravel, first add the Cashier package for Stripe to your composer.json file and run the composer update command:
Next, register the&nb...
Making Image Uploading Trait in Laravel
For uploading image in laravel we can simply make a trait and use it in any model and do the image upload. We can also do validations on the image which is explained in http://blog.samarthasinha.com/blog/making-validation-trait-laravel and http://blog.samarthasinha.com/blog/using-events-laravel-eloquent link. The code for image validation is below:
Facades in Laravel
Facades provide a static interface to classes that are available in the application service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as static proxies to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility th...
Eager Loading in Laravel
When accessing Eloquent relationships as properties, the relationship data is "lazy loaded". This means the relationship data is not actually loaded until you first access the property. However, Eloquent can "eager load" relationships at the time you query the parent model. Eager loading alleviates the N + 1 query problem. To illustrate the N + 1 query problem, consider a Book ...
Logging Request and Response with Controller and Function Name
Logging is one of the most powerful tools in software development. It gives you an idea of what your code is doing. In Laravel handling logs is very easy.
When you start a new Laravel project, error and exception handling is already configured for you. The App\Exceptions\Handler class is where all exceptions triggered by your application are logged and then rendered back to the user.
I have ...
Collations in MySQL and Laravel Database Settings
A collation is a set of rules that defines how to compare and sort character strings. Each collation in MySQL belongs to a single character set. Every character set has at least one collation, and most have two or more collations.
A collation orders characters based on weights. Each character in a character set maps to a weight. Characters with equal weights compare as equal, and characters wit...
Inserting and Updating Related Models in Laravel
The Save Method
Eloquent provides convenient methods for adding new models to relationships. For example, perhaps you need to insert a new Comment for a Post model. Instead of manually setting the post_id attribute on the Comment, you may insert the Comment directly from the relationship's save():
$comment = new App\Comment(['message' => 'A new comment.']);
Password Broker in Laravel
Password Broker: Password Broker in laravel is used to reset forgotten password for users. PasswordBroker class will create a token for user and send an email for the set new password link, where user can set a new password.
To reset password make PasswordsController and a form which will submit your email. It will point to your store() in PasswordsController which will have code...
CSRF Protection in Laravel
Laravel makes it easy to protect your application from cross-site request forgery (CSRF) attacks. Cross-site request forgeries are a type of malicious exploit whereby unauthorized commands are performed on behalf of an authenticated user.
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that ...