Laravel

Laravel How to pass parameter to Accessor method in model via where condition while query building?

I have a Accessor method in Collection Model getSizesAttribute, which returns array of available sizes eg: [‘S’,’L’], Now I need to get Models with have size ‘S’. like: $collections = $collections->where(‘sizes’,’S’); But sizes is array, could I manipulate this anyhow so that I could check returns only if sizes have…

Read More

March 6th, 2020 Laravel, PHP, SolveIt, Tutorials

Are PDO prepared statements sufficient to prevent SQL injection?

The short answer is NO, PDO prepares will not defend you from all possible SQL-Injection attacks. For certain obscure edge-cases. I’m adapting this answer to talk about PDO… The long answer isn’t so easy. It’s based off an attack demonstrated here. The Attack So, let’s start off by showing the…

Read More

May 2nd, 2018 Amazon Linux, Codeigniter, Databases, Laravel, Linux, MySQL, PHP, Tutorials, Ubuntu

How can you prevent SQL injection in PHP?

By Using prepared statements and parameterized queries. These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL. You basically have two options to achieve this: Using PDO (for any supported…

Read More

May 2nd, 2018 Articles, Codeigniter, Databases, Laravel, MySQL, PHP, Tutorials

How to change your Laravel site favicon

Remember that Laravel is serving files from the /public directory as root, not the project directory. Setting up the favicon is a two step process: Add this code to your layout page: < link rel=”shortcut icon” href=”{{ asset(‘favicon.ico’) }}” > Then put your favicon in the sites subdirectory \public It…

Read More

February 20th, 2018 Laravel, PHP, Tutorials

How to install Laravel 5.6 + PHP 7.1 with Apache on Ubuntu 16.04

Laravel is a powerful MVC-PHP framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel was created by Taylor Otwell. In this guide, we will install Laravel 5.6 on Ubuntu 16.04 and as you might already know Laravel 5.6 depends on PHP 7.1+…

Read More

February 19th, 2018 Databases, Laravel, Linux, MySQL, PHP, Tutorials, Ubuntu