Orderby in laravel

In this snippet, we’re using Laravel Eloquent to fetch users from their table and ordering them in descending order by their names thanks to the orderBy() method. $data = DB::table('posts')->where('post_status_for_frontend', 1)->orderBy('updated_at', 'desc')->paginate(4);

0 Comments

Laravel file upload

Uploading Files in Laravel is very easy. All we need to do is to create a view file where a user can select a file to be uploaded and a…

0 Comments

Google translator in laravel

composer require stichoza/google-translate-php Goto config/app.php 'aliases' => [ 'GoogleTranslate' => stichoza\GoogleTranslate\GoogleTranslate::class, ] Make routes Route::get('lang', 'GTranslator@lang')->name('lang'); Route::get('lang/change', 'GTranslator@langTranslator')->name('langTranslator'); Make a controller suppose name is GTranslator In GTranslator.php <?php namespace App\Http\Controllers;…

0 Comments

Export pdf in laravel

Install dompdf package composer require barryvdh/laravel-dompdf Enable GD & zip extension first (php.ini), then use this cmd. Goto config / app.php 'providers' => [ Barryvdh\DomPDF\ServiceProvider::class, ]; 'aliases' => [ 'PDF'…

0 Comments

Social share button in laravel using navigator share api

Goto this website for api https://crunchify.com/list-of-all-social-sharing-urls-for-handy-reference-social-media-sharing-buttons-without-javascript/ Click number of calling tel:1234567890 Click email for sending mail mailto:example@gmail.com Links for social share A. https://api.whatsapp.com/send?text=[post-title] [post-url] <a href="https://api.whatsapp.com/send?text=All Active Members <?php echo…

0 Comments

Row count and sum in laravel

$count = DB::table('is_profile_completed')->where('userd', $userid)->count(); $sum = DB::table('is_profile_completed')->where('userd', $userid)->sum('salary'); $data = DB::table('posts')->where('post_status_for_frontend', 1)->orderBy('updated_at', 'desc')->paginate(4); {{count($data)}}  

0 Comments