Skip to content
Advertisement

Tag: laravel-5

laravel seeds unique column ignore duplicate entries

i have a Seeder in Laravel in this email is unique, when I run first time its entering records into the database, when I run again its showing duplicate entry. do i have option to ignore that.? Answer We have an option to check whether the given email exists in the table or not.

Laravel Auth Login Page Just Refreshes

I am using Laravel 5.4. I ran the make:auth command to scaffold out my auth controllers and views. I can register a new account without issue as it is showing up in my database. However when I try to login, the login page simply refreshes without any errors being thrown. In the login controller I have the redirect set to

How to check user input in laravel

I have a column input named Address, and how to check, if user input like null, ‘null’ and ” , the return response will be error. I have make it, but it not working. This is my code: Answer You may use the empty function, which would return FALSE if var exists and has a non-empty, non-zero value. Otherwise returns

How can I store random_bytes in a database in PHP?

Inside of my migration I have a string column named encryption_key which looks like this: I have a Controller that uses a trait to generate the encryption commands. The trait looks like this so far However, upon testing this I receive this error: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: ‘xFFXx8Afx1F$…’ for column ‘encryption_key’ at row 1 (SQL: insert

Laravel / League Fractal returns an empty array instead of empty object

I’m having a problem with Fractal library. I’m using Spatielaravel-fractal library which is just wrapper for Leaguefractal. So… I want to return an empty object instead of an empty array. $this->null() always returns [] after generation and I want to return {}. Tbh I want to have 2 functions like $this->nullItem() and $this->nullCollection(). Does anyone know what’s the solution to

Laravel 5.4 environment based config files

I am trying to change the Laravel configuration variables based on environment, but I do not know how. Code to get config is I am trying to have a separate results for the live environment and the development environment. Real life scenario I need to override some config files, so everybody who is using the development environment, has the same

Advertisement