Laravel 8 Share Social Media Button
Hello Dev,
At present, i we are going to present you laravel Eight share social media button. This text offers you easy instance of laravel Eight share social media button. you’ll study laravel Eight share social media button.
On this artical i’ll present you laravel Eight share social media button. We will use this instance in Laravel 6, Laravel 7, Laravel 8, all. So let’s comply with few step to create instance of laravel Eight share social media button.
Preview:
Step 1:- Set up Laravel
First of, open your terminal and set up new Laravel:
composer create-project --prefer-dist laravel/laravel sharesocial
Step 2:- Join Database .env
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=databse DB_USERNAME=root DB_PASSWORD=
Step 3:- Set up Social Media Bundle
On this step, folllowing command and set up social media button bundle in laravel
composer require jorenvanhocht/laravel-share
After that, go to config listing and open app.php file. And add code:
config/app.php
'aliases' => [ 'Share' => JorenvhShareShareFacade::class, ]
following command and publish config file:
php artisan vendor:publish --provider="JorenvhShareProvidersShareServiceProvider"
Step 4:- Add Routes
Go to routes/net.php file and following routes in net.php file:
use AppHttpControllersShareSocialController; Route::get('/share-social', [ShareSocialController::class,'shareSocial']);
Step 5:- Create Controllers
run following command and create controllers
php artisan make:controller ShareSocialController
app/http/controllerShareSocialController.php
<?php namespace AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportFacadesRoute; class ShareSocialController extends Controller { public operate shareSocial() { $socialShare = Share::web page( 'https://codeplaners.com/', 'Code Planers', ) ->fb() ->twitter() ->reddit() ->linkedin() ->whatsapp() ->telegram(); return view('index', compact('socialShare')); } }
Step 6:- Create Blade Views
On this step, create one blade views file. assets/views folder and create the blade view file:
Create file share-social.blade.php and add code:
<!DOCTYPE html> <html> <head> <title>Laravel Eight Share Social Media Button</title> <hyperlink rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js" ></script> <hyperlink rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" /> <type sort="textual content/css"> li{ list-style: none; background: #e2e2e2; margin-left: 5px; text-align: middle; border-radius:5px; } li span{ font-size: 20px; } ul li{ show: inline-block; padding: 10px 10px 5px; } #social-links{ float: left; } a.social-button { coloration: #000; } </type> </head> <physique type="background: #8ab4e8;"> <div class="row mt-5"> <div class="col-md-6 offset-3"> <div class="card"> <div class="card-header bg-success text-white"> <h5>Laravel Eight Share Social Media Button</h5> </div> <div class="card-body"> <robust class="float-left pt-2">Social Media : </robust> {!! $socialShare !!} </div> </div> </div> </div> </physique> </html>
Step 7:- Run Growth Server
php artisan serve
http://127.0.0.1:8000/share-social
Komentar
Posting Komentar