Laravel pagination

Controller: function car_details(Request $req, $id){ $data = DB::table('car_comparision')->paginate(10); return view('admin/carcomparision.all_cars', ['data' => $data]); } View: <div class="container"> @foreach ($usersas$user) {{$user->name}} @endforeach </div> <div class="d-flex"> {{ $data->links() }} </div> // Directly…

0 Comments

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