Get user by id in laravel 5

laravel 5 get first record get single value from eloquent laravel get one value from database Laravel function to get user details by email or id in Laravel public function getUserByEmail(Request $request){ $email =$request->input(’email’); $user = User::where(’email’,$email)->first(); return $user; } of if id is known simply use public function getUserById(Request $request){ $id =$request->input(‘id’); $user = […]

Read More

Configuring and using multiple databases in Laravel

Step by step guide to display wordpress posts in Laravel 5.4

Configuring and using multiple databases in Laravel | Fetching WordPress posts in Laravel | Creating Global scopes in Laravel Models laravel 5 multiple databases | laravel model database laravel 5.2 multiple databases laravel 5 dynamic database connection laravel dynamic database connection | laravel change default database connection laravel change database connection laravel multiple db connections […]

Read More

Uploading a Base 64 image in laravel 5.4

Function to create an image from base64 format in Laravel 5.4

Uploading a Base 64 image in laravel 5.4 //Function to save a base64 image in laravel 5.4 public function createImageFromBase64(Request $request){ $file_data = $request->input(‘company_logo’); //generating unique file name; $file_name = ‘image_’.time().’.png’; @list($type, $file_data) = explode(‘;’, $file_data); @list(, $file_data) = explode(‘,’, $file_data); if($file_data!=””){ // storing image in storage/app/public Folder \Storage::disk(‘public’)->put($file_name,base64_decode($file_data)); } }

Read More