Daniel  Hughes

Daniel Hughes

1673071260

Showtime Is A Web3 Social Network

Showtime Monorepo

The Showtime app powered by Expo, Next.js, Storybook and Universal UI.

You'll find included:

Getting started

cp apps/expo/.env.development apps/next/.env then ask the team if the env is correct

yarn

yarn dev:next

Architecture

Introduction: How to build a great universal design system by Axel Delafosse

App

Code shared between iOS, Android and Web

cd packages/app

Design System

Universal design system

cd packages/design-system

Read more about the design system.

Expo

React Native

Expo entrypoint: apps/expo/App.tsx

cd apps/expo

yarn dev to start the development client (iOS and Android app with Expo)

Next.js (React Native)

Web

Next.js entrypoint: apps/next/src/pages/_app.tsx

cd apps/next

yarn dev to start the web app

Storybook React

Storybook for Web (using React Native for Web)

Storybook config: apps/storybook-react/.storybook/*

cd apps/storybook-react

yarn dev to start Storybook

Storybook (React Native)

Storybook for React Native

Storybook config: apps/storybook-react-native/.storybook/*

cd apps/storybook-react-native

yarn dev to start Storybook

Mobile Development Client

You can create a development client in local or in the cloud.

Expo Dev Client

  • We're using expo dev client for development builds which allows us to add custom/third party native libraries while preserving the expo like developer experience. Read more about custom dev clients here
  • You only need to build and install custom dev client in below cases.
  1. If you don't have it installed on your phone or simulator
  2. If you make any changes on native side or add a new native library
  • To install dev client, plug your device and run below commands. This will install the dev client and start the Metro bundler.
// For iOS
yarn ios -d

// For android
yarn android
  • For subsequent developments, we can simply start the Metro bundler, no need to build dev client again. Run the command below to start the bundler.

yarn dev:expo

Local

❗️ The yarn script commands are from within the @showtime/expo application ❗️

Plug your device and build the app with Expo CLI:

yarn ios -d
yarn android -d

iOS: if yarn ios -d doesn't detect your iPhone, make sure that you have compatible Xcode and iOS versions.

Android: if you are on a Mac M1, please install the following JDK: curl -s "https://get.sdkman.io" | bash sdk install java 11.0.14-zulu

Cloud

Use Expo Application Services to build the app:

yarn build:development

This is useful if you want to build the iOS app without a Mac, for example.

Design system (Universal UI)

React Native for Web + Tailwind

Note that we use custom utilities for the fonts to use capsize. It's applying negative margin-top and margin-bottom so you can't use those on <Text> directly. Prefer using a separator <View tw="h-2" /> instead of <Text tw="mt-2" /> or <Text tw="mb-2" /> for example.

State Management

SWR

  • SWRConfig in apps/expo/App.tsx and apps/next/src/pages/_app.tsx

Data Fetching

SWR + axios

  • axiosAPI in packages/app/lib/axios.ts
  • useSWR hooks like const { data, error } = useSWR([url], url => axios({ url, method: 'GET', unmountSignal }))
  • packages/app/hooks/use-user.ts

Navigation

React Navigation + Next.js Router

How to create a new screen

// TODO:

Authentication

Magic + WalletConnect

  • packages/app/components/login.tsx

Analytics

RudderStack

Testing

Waldo + QA Wolf

Deployment

Vercel + Expo

CI/CD

GitHub Actions

Environment Variables

Using dotenv for the Expo app. Next.js is automatically picking up the .env.local file.

  • .env.development + .env.staging + .env.production in apps/expo
  • .env in apps/next

Release Cycle

Native

Over The Air Update (EAS Update)

Increment the patch version in the root package.json

Run yarn update:production in apps/expo

Close and re-open the production app twice to check the new update

Native Build (EAS Build + EAS Submit)

Increment the major version in the root package.json

Run yarn deploy:production in apps/expo

Submit the new build for review on TestFlight and Google Play

Web

CI/CD with Vercel for PR previews + GitHub Actions via /promote Slack command

You can use the /promote frontend Slack command to promote from staging to production.

Use /promote frontend major to force a major update (e.g. when you want to force a new native build). Otherwise the version will be incremented automatically and an OTA update will be done if we don't require a new native build.

Notes

Pro tip: you can add tw to Tailwind CSS: Class Attributes VS Code extension setting to get IntelliSense working.

Pro tip: Ignore a list of commits within git-blame by default on version >2.23

git config blame.ignoreRevsFile .git-blame-ignore-revs

Usage

Here is a quick overview of the repo.

Commands

The monorepo leverages Turborepo as it's build system. There are a lot of advantages to Turborepo but two deciding factors were

  1. Faster, incremental builds
  2. Cloud caching, managed by Vercel

Turbo pipelines are configured within the root directory package.json and can be ran through yarn scripts.

Development

Build

Start

Lint

Formatting

The formatting rules are the ones from prettier/recommended. The actual formatting is done via eslint.

To get formatting on save in VS Code, install the eslint extension and add the following setting:

"editor.codeActionsOnSave": {  "source.fixAll.eslint": true }

Graph

Utility scripts

  • clean removes all monorepo node_modules and clears the turbo cache
  • clean:turbo clears the turbo cache
  • clean:node-modules removes all node_modules
  • clean:native runs yarn clean and removes android, iOS folders from expo and storybook-react-native apps.

Enable Remote Cache

Turbo can use a technique known as Remote Caching to share cache artifacts across machines for an additional speed boost.

Local Remote Cache

Link your local turbo project to the remote cache through Vercel

npx turbo login

npx turbo link

To verify, build and delete your local turbo cache with:

  1. Run any build locally
  2. Clear the turbo cache yarn clean:turbo
  3. Then run the same build again. If things are working properly, turbo should not execute tasks locally

Troubleshooting

If Vercel is not deploying after updating or adding a patch package, you need to click on "Redeploy" on Vercel and don’t select "Use the same cache". Most of the time, it is a cache issue.

Root

  • Don't add any package here

App

  • Don't add any package here
  • You can use SVGR to generate the icons component from the .svg files: npx @svgr/cli --icon --replace-attr-values "#000={props.color},#fff={props.color},#FFF={props.color}" --ignore-existing --native --typescript -d . . and then you can programmatically change the color thanks to fill={props.color} for example.

Expo

  • Add all the React Native and universal packages here

Next.js

  • Add the web-only packages here

Quick Style Guide

  • Filenames: lowercase and separated by dashes
  • Prefer absolute imports
  • Avoid coding in the index.tsx file, create a new file and export it from the index.ts file
  • export { Component } instead of export default Component

Universal App

Showtime is a web3 social network ✨

Universal Design System

Universal is a design system created by Showtime to help teams build high-quality digital experiences for iOS, Android, and the Web.


Download details:

Author:  showtime-xyz
Source code: https://github.com/showtime-xyz/showtime-frontend

License: MIT license

#web3 

What is GEEK

Buddha Community

Showtime Is A Web3 Social Network

Como Adicionar O Botão De Compartilhamento Social No Laravel 8

O pacote Laravel Share permite que você gere dinamicamente botões de compartilhamento social de redes sociais populares para aumentar o engajamento de mídia social.

Isso permite que os visitantes do site compartilhem facilmente o conteúdo com suas conexões e redes de mídia social.

Neste tutorial, mostro como você pode adicionar links de compartilhamento social em seu projeto Laravel 8 usando o pacote Laravel Share.

1. Instale o pacote

Instale o pacote usando o compositor –

composer require jorenvanhocht/laravel-share

2. Atualize app.php

  • Abrir config/app.phparquivo.
  • Adicione o seguinte Jorenvh\Share\Providers\ShareServiceProvider::classem 'providers'
'providers' => [
      ....
      ....
      ....  
      Jorenvh\Share\Providers\ShareServiceProvider::class,
];
  • Adicione o seguinte 'Share' => Jorenvh\Share\ShareFacade::classem 'aliases'
'aliases' => [
     .... 
     .... 
     .... 
     'Share' => Jorenvh\Share\ShareFacade::class,
];

3. Publicar pacote

Execute o comando -

php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"

4. Rota

  • Abrir  routes/web.php arquivo.
  • Crie uma rota -
    • / – Carregar visualização de índice.

Código concluído

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;

Route::get('/', [PageController::class, 'index']);

5. Controlador

  • Criar  PageController controlador.
php artisan make:controller PageController
  • Abrir  app/Http/Controllers/PageController.php arquivo.
  • Criar 1 método –

index() – Crie um link de compartilhamento usando Share::page()e atribua a $shareButtons1. Da mesma forma, crie mais 2 links e atribua as variáveis.

Carregue indexa visualização e passe $shareButtons1, $shareButtons2, e $shareButtons3.

Código concluído

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
         public function index(){

               // Share button 1
               $shareButtons1 = \Share::page(
                     'https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Share button 2
               $shareButtons2 = \Share::page(
                     'https://makitweb.com/how-to-make-autocomplete-search-using-jquery-ui-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram();

               // Share button 3
               $shareButtons3 = \Share::page(
                      'https://makitweb.com/how-to-upload-multiple-files-with-vue-js-and-php/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Load index view
               return view('index')
                     ->with('shareButtons1',$shareButtons1 )
                     ->with('shareButtons2',$shareButtons2 )
                     ->with('shareButtons3',$shareButtons3 );
         }
}

6. Visualizar

Criar index.blade.php arquivo na  resources/views/ pasta.

Inclua Bootstrap, CSS de fonte incrível, jQuery e js/share.js. –

<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Share JS -->
<script src="{{ asset('js/share.js') }}"></script>

Adicionado CSS para personalizar links de compartilhamento social.

Exiba links de compartilhamento social usando –

{!! $shareButtons1 !!}

Da mesma forma, exiba outros 2 – {!! $shareButtons2 !!} e {!! $shareButtons3 !!}.

Código concluído

<!DOCTYPE html>
<html>
<head>
     <title>Add social share button in Laravel 8 with Laravel Share</title>

     <!-- Meta -->
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <!-- CSS -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

     <!-- Share JS -->
     <script src="{{ asset('js/share.js') }}"></script>

     <style>
     #social-links ul{
          padding-left: 0;
     }
     #social-links ul li {
          display: inline-block;
     } 
     #social-links ul li a {
          padding: 6px;
          border: 1px solid #ccc;
          border-radius: 5px;
          margin: 1px;
          font-size: 25px;
     }
     #social-links .fa-facebook{
           color: #0d6efd;
     }
     #social-links .fa-twitter{
           color: deepskyblue;
     }
     #social-links .fa-linkedin{
           color: #0e76a8;
     }
     #social-links .fa-whatsapp{
          color: #25D366
     }
     #social-links .fa-reddit{
          color: #FF4500;;
     }
     #social-links .fa-telegram{
          color: #0088cc;
     }
     </style>
</head>
<body>

    <div class='container'>

         <!-- Post 1 -->
         <div class='row mt-5'>
               <h2>Datatables AJAX pagination with Search and Sort in Laravel 8</h2>

               <p>With pagination, it is easier to display a huge list of data on the page.</p>

               <p>You can create pagination with and without AJAX.</p>

               <p>There are many jQuery plugins are available for adding pagination. One of them is DataTables.</p>

               <p>In this tutorial, I show how you can add Datatables AJAX pagination without the Laravel package in Laravel 8.</p>

               <!-- Social Share buttons 1 -->
               <div class="social-btn-sp">
                     {!! $shareButtons1 !!}
               </div> 
          </div>

          <!-- Post 2 -->
          <div class='row mt-5'>
                 <h2>How to make Autocomplete search using jQuery UI in Laravel 8</h2>

                 <p>jQuery UI has different types of widgets available, one of them is autocomplete.</p>

                 <p>Data is loaded according to the input after initialize autocomplete on a textbox. User can select an option from the suggestion list.</p>

                 <p>In this tutorial, I show how you can make autocomplete search using jQuery UI in Laravel 8.</p>

                 <!-- Social Share buttons 2 -->
                 <div class="social-btn-sp">
                        {!! $shareButtons2 !!}
                 </div>
           </div>

           <!-- Post 3 -->
           <div class='row mt-5 mb-5'>
                 <h2>How to upload multiple files with Vue.js and PHP</h2>

                 <p>Instead of adding multiple file elements, you can use a single file element for allowing the user to upload more than one file.</p>

                 <p>Using the FormData object to pass the selected files to the PHP for upload.</p>

                 <p>In this tutorial, I show how you can upload multiple files using Vue.js and PHP.</p>

                 <!-- Social Share buttons 3 -->
                 <div class="social-btn-sp">
                      {!! $shareButtons3 !!}
                 </div>
           </div>

     </div>
</body>
</html>

7. Demonstração

Ver demonstração


8. Conclusão

No exemplo, consertei os links, mas você pode configurá-los dinamicamente.

Personalize o design usando CSS e o número de ícones sociais visíveis usando o controlador.

Usando o pacote Laravel Share, você pode compartilhar links para –

  • Facebook,
  • Twitter,
  • LinkedIn,
  • Whatsapp,
  • Reddit, e
  • Telegrama

Fonte:  https://makitweb.com

#php #laravel 

Jarrod  Douglas

Jarrod Douglas

1658370780

Ajouter Un Bouton De Partage Social Dans Laravel 8 Avec Laravel Share

Le package Laravel Share vous permet de générer dynamiquement des boutons de partage social à partir de réseaux sociaux populaires pour augmenter l'engagement sur les réseaux sociaux.

Ceux-ci permettent aux visiteurs du site Web de partager facilement le contenu avec leurs connexions et réseaux de médias sociaux.

Dans ce didacticiel, je montre comment vous pouvez ajouter des liens de partage social dans votre projet Laravel 8 à l'aide du package Laravel Share.

1. Installer le package

Installez le package à l'aide de composer -

composer require jorenvanhocht/laravel-share

2. Mettre à jour app.php

  • Ouvrir config/app.phple fichier.
  • Ajoutez ce qui suit Jorenvh\Share\Providers\ShareServiceProvider::classdans 'providers'-
'providers' => [
      ....
      ....
      ....  
      Jorenvh\Share\Providers\ShareServiceProvider::class,
];
  • Ajoutez ce qui suit 'Share' => Jorenvh\Share\ShareFacade::classdans 'aliases'-
'aliases' => [
     .... 
     .... 
     .... 
     'Share' => Jorenvh\Share\ShareFacade::class,
];

3. Publier le package

Exécutez la commande -

php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"

4. Itinéraire

  • Ouvrir  routes/web.php le fichier.
  • Créer un itinéraire -
    • / – Charger la vue d'index.

Code terminé

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;

Route::get('/', [PageController::class, 'index']);

5. Contrôleur

  • Créer  PageController un contrôleur.
php artisan make:controller PageController
  • Ouvrir  app/Http/Controllers/PageController.php le fichier.
  • Créer 1 méthode –

index() - Créez un lien de partage en utilisant Share::page()et attribuez-le à $shareButtons1. De même, créez 2 autres liens et affectez-les aux variables.

Charger la indexvue et passer $shareButtons1, $shareButtons2et $shareButtons3.

Code terminé

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
         public function index(){

               // Share button 1
               $shareButtons1 = \Share::page(
                     'https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Share button 2
               $shareButtons2 = \Share::page(
                     'https://makitweb.com/how-to-make-autocomplete-search-using-jquery-ui-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram();

               // Share button 3
               $shareButtons3 = \Share::page(
                      'https://makitweb.com/how-to-upload-multiple-files-with-vue-js-and-php/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Load index view
               return view('index')
                     ->with('shareButtons1',$shareButtons1 )
                     ->with('shareButtons2',$shareButtons2 )
                     ->with('shareButtons3',$shareButtons3 );
         }
}

6. Voir

Créer index.blade.php un fichier dans  resources/views/ le dossier.

Incluez Bootstrap, CSS font-awesome, jQuery et js/share.js. –

<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Share JS -->
<script src="{{ asset('js/share.js') }}"></script>

CSS ajouté pour personnaliser les liens de partage social.

Afficher les liens de partage social en utilisant –

{!! $shareButtons1 !!}

De même, affichez les autres 2 – {!! $shareButtons2 !!}, et { !! $shareButtons3 !!}.

Code terminé

<!DOCTYPE html>
<html>
<head>
     <title>Add social share button in Laravel 8 with Laravel Share</title>

     <!-- Meta -->
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <!-- CSS -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

     <!-- Share JS -->
     <script src="{{ asset('js/share.js') }}"></script>

     <style>
     #social-links ul{
          padding-left: 0;
     }
     #social-links ul li {
          display: inline-block;
     } 
     #social-links ul li a {
          padding: 6px;
          border: 1px solid #ccc;
          border-radius: 5px;
          margin: 1px;
          font-size: 25px;
     }
     #social-links .fa-facebook{
           color: #0d6efd;
     }
     #social-links .fa-twitter{
           color: deepskyblue;
     }
     #social-links .fa-linkedin{
           color: #0e76a8;
     }
     #social-links .fa-whatsapp{
          color: #25D366
     }
     #social-links .fa-reddit{
          color: #FF4500;;
     }
     #social-links .fa-telegram{
          color: #0088cc;
     }
     </style>
</head>
<body>

    <div class='container'>

         <!-- Post 1 -->
         <div class='row mt-5'>
               <h2>Datatables AJAX pagination with Search and Sort in Laravel 8</h2>

               <p>With pagination, it is easier to display a huge list of data on the page.</p>

               <p>You can create pagination with and without AJAX.</p>

               <p>There are many jQuery plugins are available for adding pagination. One of them is DataTables.</p>

               <p>In this tutorial, I show how you can add Datatables AJAX pagination without the Laravel package in Laravel 8.</p>

               <!-- Social Share buttons 1 -->
               <div class="social-btn-sp">
                     {!! $shareButtons1 !!}
               </div> 
          </div>

          <!-- Post 2 -->
          <div class='row mt-5'>
                 <h2>How to make Autocomplete search using jQuery UI in Laravel 8</h2>

                 <p>jQuery UI has different types of widgets available, one of them is autocomplete.</p>

                 <p>Data is loaded according to the input after initialize autocomplete on a textbox. User can select an option from the suggestion list.</p>

                 <p>In this tutorial, I show how you can make autocomplete search using jQuery UI in Laravel 8.</p>

                 <!-- Social Share buttons 2 -->
                 <div class="social-btn-sp">
                        {!! $shareButtons2 !!}
                 </div>
           </div>

           <!-- Post 3 -->
           <div class='row mt-5 mb-5'>
                 <h2>How to upload multiple files with Vue.js and PHP</h2>

                 <p>Instead of adding multiple file elements, you can use a single file element for allowing the user to upload more than one file.</p>

                 <p>Using the FormData object to pass the selected files to the PHP for upload.</p>

                 <p>In this tutorial, I show how you can upload multiple files using Vue.js and PHP.</p>

                 <!-- Social Share buttons 3 -->
                 <div class="social-btn-sp">
                      {!! $shareButtons3 !!}
                 </div>
           </div>

     </div>
</body>
</html>

7. Démo

Voir la démo


8.Conclusion

Dans l'exemple, j'ai corrigé les liens mais vous pouvez les définir dynamiquement.

Personnalisez la conception à l'aide de CSS et du nombre d'icônes sociales visibles à l'aide du contrôleur.

En utilisant le package Laravel Share, vous pouvez partager des liens vers -

  • Facebook,
  • Twitter,
  • LinkedIn,
  • WhatsApp,
  • Reddit, et
  • Télégramme

Source :  https://makitweb.com

#php #laravel 

Wayne  Richards

Wayne Richards

1658363460

Cómo Agregar El Botón Social Share En Laravel 8 Con Laravel Share

El paquete Laravel Share le permite generar dinámicamente botones para compartir en redes sociales populares para aumentar la participación en las redes sociales.

Estos permiten a los visitantes del sitio web compartir fácilmente el contenido con sus conexiones y redes sociales.

En este tutorial, muestro cómo puede agregar enlaces para compartir en redes sociales en su proyecto Laravel 8 usando el paquete Laravel Share.

1. Paquete de instalación

Instale el paquete usando composer –

composer require jorenvanhocht/laravel-share

2. Actualizar aplicación.php

  • Abrir config/app.phparchivo.
  • Agregue lo siguiente Jorenvh\Share\Providers\ShareServiceProvider::classen 'providers'
'providers' => [
      ....
      ....
      ....  
      Jorenvh\Share\Providers\ShareServiceProvider::class,
];
  • Agregue lo siguiente 'Share' => Jorenvh\Share\ShareFacade::classen 'aliases'
'aliases' => [
     .... 
     .... 
     .... 
     'Share' => Jorenvh\Share\ShareFacade::class,
];

3. Publicar paquete

Ejecute el comando –

php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"

4. Ruta

  • Abrir  routes/web.php archivo.
  • Crear una ruta -
    • / – Cargar vista de índice.

Código completado

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;

Route::get('/', [PageController::class, 'index']);

5. Controlador

  • Crear  PageController controlador.
php artisan make:controller PageController
  • Abrir  app/Http/Controllers/PageController.php archivo.
  • Crear 1 método –

index (): cree un enlace compartido usando Share::page()y asigne a $shareButtons1. Del mismo modo, cree 2 enlaces más y asígnelos a variables.

Cargue la indexvista y pase $shareButtons1, $shareButtons2y $shareButtons3.

Código completado

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
         public function index(){

               // Share button 1
               $shareButtons1 = \Share::page(
                     'https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Share button 2
               $shareButtons2 = \Share::page(
                     'https://makitweb.com/how-to-make-autocomplete-search-using-jquery-ui-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram();

               // Share button 3
               $shareButtons3 = \Share::page(
                      'https://makitweb.com/how-to-upload-multiple-files-with-vue-js-and-php/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Load index view
               return view('index')
                     ->with('shareButtons1',$shareButtons1 )
                     ->with('shareButtons2',$shareButtons2 )
                     ->with('shareButtons3',$shareButtons3 );
         }
}

6. Ver

Crear index.blade.php archivo en  resources/views/ carpeta.

Incluya Bootstrap, font-awesome CSS, jQuery y js/share.js. –

<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Share JS -->
<script src="{{ asset('js/share.js') }}"></script>

Se agregó CSS ​​para personalizar los enlaces para compartir en redes sociales.

Mostrar enlaces para compartir en redes sociales usando –

{!! $shareButtons1 !!}

Del mismo modo, muestra otros 2 – {!! $shareButtons2 !!}, y {!! $compartirBotones3 !!}.

Código completado

<!DOCTYPE html>
<html>
<head>
     <title>Add social share button in Laravel 8 with Laravel Share</title>

     <!-- Meta -->
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <!-- CSS -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

     <!-- Share JS -->
     <script src="{{ asset('js/share.js') }}"></script>

     <style>
     #social-links ul{
          padding-left: 0;
     }
     #social-links ul li {
          display: inline-block;
     } 
     #social-links ul li a {
          padding: 6px;
          border: 1px solid #ccc;
          border-radius: 5px;
          margin: 1px;
          font-size: 25px;
     }
     #social-links .fa-facebook{
           color: #0d6efd;
     }
     #social-links .fa-twitter{
           color: deepskyblue;
     }
     #social-links .fa-linkedin{
           color: #0e76a8;
     }
     #social-links .fa-whatsapp{
          color: #25D366
     }
     #social-links .fa-reddit{
          color: #FF4500;;
     }
     #social-links .fa-telegram{
          color: #0088cc;
     }
     </style>
</head>
<body>

    <div class='container'>

         <!-- Post 1 -->
         <div class='row mt-5'>
               <h2>Datatables AJAX pagination with Search and Sort in Laravel 8</h2>

               <p>With pagination, it is easier to display a huge list of data on the page.</p>

               <p>You can create pagination with and without AJAX.</p>

               <p>There are many jQuery plugins are available for adding pagination. One of them is DataTables.</p>

               <p>In this tutorial, I show how you can add Datatables AJAX pagination without the Laravel package in Laravel 8.</p>

               <!-- Social Share buttons 1 -->
               <div class="social-btn-sp">
                     {!! $shareButtons1 !!}
               </div> 
          </div>

          <!-- Post 2 -->
          <div class='row mt-5'>
                 <h2>How to make Autocomplete search using jQuery UI in Laravel 8</h2>

                 <p>jQuery UI has different types of widgets available, one of them is autocomplete.</p>

                 <p>Data is loaded according to the input after initialize autocomplete on a textbox. User can select an option from the suggestion list.</p>

                 <p>In this tutorial, I show how you can make autocomplete search using jQuery UI in Laravel 8.</p>

                 <!-- Social Share buttons 2 -->
                 <div class="social-btn-sp">
                        {!! $shareButtons2 !!}
                 </div>
           </div>

           <!-- Post 3 -->
           <div class='row mt-5 mb-5'>
                 <h2>How to upload multiple files with Vue.js and PHP</h2>

                 <p>Instead of adding multiple file elements, you can use a single file element for allowing the user to upload more than one file.</p>

                 <p>Using the FormData object to pass the selected files to the PHP for upload.</p>

                 <p>In this tutorial, I show how you can upload multiple files using Vue.js and PHP.</p>

                 <!-- Social Share buttons 3 -->
                 <div class="social-btn-sp">
                      {!! $shareButtons3 !!}
                 </div>
           </div>

     </div>
</body>
</html>

7. demostración

Ver demostración


8. Conclusión

En el ejemplo, arreglé los enlaces pero puedes configurarlos dinámicamente.

Personaliza el diseño usando CSS y la cantidad de íconos sociales visibles usando el controlador.

Usando el paquete Laravel Share puede compartir enlaces a –

  • Facebook,
  • Gorjeo,
  • LinkedIn,
  • WhatsApp,
  • reddit, y
  • Telegrama

Fuente:  https://makitweb.com

#php #laravel 

Duyen Hoang

Duyen Hoang

1658389080

Cách Thêm Nút Chia Sẻ Xã Hội Trong Laravel 8 Với Laravel Share

Gói Laravel Share cho phép bạn tạo động các nút chia sẻ xã hội từ các mạng xã hội phổ biến để tăng mức độ tương tác trên mạng xã hội.

Những điều này cho phép khách truy cập trang web dễ dàng chia sẻ nội dung với các kết nối và mạng xã hội của họ.

Trong hướng dẫn này, tôi chỉ cách bạn có thể thêm liên kết chia sẻ xã hội trong dự án Laravel 8 của mình bằng cách sử dụng gói Laravel Share.

1. Cài đặt gói

Cài đặt gói bằng trình soạn nhạc -

composer require jorenvanhocht/laravel-share

2. Cập nhật app.php

  • Mở config/app.phptệp.
  • Thêm phần sau Jorenvh\Share\Providers\ShareServiceProvider::classvào 'providers'-
'providers' => [
      ....
      ....
      ....  
      Jorenvh\Share\Providers\ShareServiceProvider::class,
];
  • Thêm phần sau 'Share' => Jorenvh\Share\ShareFacade::classvào 'aliases'-
'aliases' => [
     .... 
     .... 
     .... 
     'Share' => Jorenvh\Share\ShareFacade::class,
];

3. Xuất bản gói

Chạy lệnh -

php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"

4. Lộ trình

  • Mở  routes/web.php tệp.
  • Tạo một tuyến đường -
    • / - Tải chế độ xem chỉ mục.

Mã đã hoàn thành

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;

Route::get('/', [PageController::class, 'index']);

5. Bộ điều khiển

  • Tạo  PageController Bộ điều khiển.
php artisan make:controller PageController
  • Mở  app/Http/Controllers/PageController.php tệp.
  • Tạo 1 phương pháp -

index () - Tạo một liên kết chia sẻ bằng cách sử dụng Share::page()và gán cho $shareButtons1. Tương tự, tạo thêm 2 liên kết và gán cho các biến.

Tải indexchế độ xem và vượt qua $shareButtons1, $shareButtons2$shareButtons3.

Mã đã hoàn thành

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
         public function index(){

               // Share button 1
               $shareButtons1 = \Share::page(
                     'https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Share button 2
               $shareButtons2 = \Share::page(
                     'https://makitweb.com/how-to-make-autocomplete-search-using-jquery-ui-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram();

               // Share button 3
               $shareButtons3 = \Share::page(
                      'https://makitweb.com/how-to-upload-multiple-files-with-vue-js-and-php/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Load index view
               return view('index')
                     ->with('shareButtons1',$shareButtons1 )
                     ->with('shareButtons2',$shareButtons2 )
                     ->with('shareButtons3',$shareButtons3 );
         }
}

6. Xem

Tạo index.blade.php tệp trong  resources/views/ thư mục.

Bao gồm Bootstrap, CSS font-awesome, jQuery và js / share.js. -

<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Share JS -->
<script src="{{ asset('js/share.js') }}"></script>

Đã thêm CSS để tùy chỉnh các liên kết chia sẻ trên mạng xã hội.

Hiển thị các liên kết chia sẻ xã hội bằng cách sử dụng -

{!! $shareButtons1 !!}

Tương tự, hiển thị 2 - {!! $ shareButtons2 !!} và {!! $ shareButtons3 !!}.

Mã đã hoàn thành

<!DOCTYPE html>
<html>
<head>
     <title>Add social share button in Laravel 8 with Laravel Share</title>

     <!-- Meta -->
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <!-- CSS -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

     <!-- Share JS -->
     <script src="{{ asset('js/share.js') }}"></script>

     <style>
     #social-links ul{
          padding-left: 0;
     }
     #social-links ul li {
          display: inline-block;
     } 
     #social-links ul li a {
          padding: 6px;
          border: 1px solid #ccc;
          border-radius: 5px;
          margin: 1px;
          font-size: 25px;
     }
     #social-links .fa-facebook{
           color: #0d6efd;
     }
     #social-links .fa-twitter{
           color: deepskyblue;
     }
     #social-links .fa-linkedin{
           color: #0e76a8;
     }
     #social-links .fa-whatsapp{
          color: #25D366
     }
     #social-links .fa-reddit{
          color: #FF4500;;
     }
     #social-links .fa-telegram{
          color: #0088cc;
     }
     </style>
</head>
<body>

    <div class='container'>

         <!-- Post 1 -->
         <div class='row mt-5'>
               <h2>Datatables AJAX pagination with Search and Sort in Laravel 8</h2>

               <p>With pagination, it is easier to display a huge list of data on the page.</p>

               <p>You can create pagination with and without AJAX.</p>

               <p>There are many jQuery plugins are available for adding pagination. One of them is DataTables.</p>

               <p>In this tutorial, I show how you can add Datatables AJAX pagination without the Laravel package in Laravel 8.</p>

               <!-- Social Share buttons 1 -->
               <div class="social-btn-sp">
                     {!! $shareButtons1 !!}
               </div> 
          </div>

          <!-- Post 2 -->
          <div class='row mt-5'>
                 <h2>How to make Autocomplete search using jQuery UI in Laravel 8</h2>

                 <p>jQuery UI has different types of widgets available, one of them is autocomplete.</p>

                 <p>Data is loaded according to the input after initialize autocomplete on a textbox. User can select an option from the suggestion list.</p>

                 <p>In this tutorial, I show how you can make autocomplete search using jQuery UI in Laravel 8.</p>

                 <!-- Social Share buttons 2 -->
                 <div class="social-btn-sp">
                        {!! $shareButtons2 !!}
                 </div>
           </div>

           <!-- Post 3 -->
           <div class='row mt-5 mb-5'>
                 <h2>How to upload multiple files with Vue.js and PHP</h2>

                 <p>Instead of adding multiple file elements, you can use a single file element for allowing the user to upload more than one file.</p>

                 <p>Using the FormData object to pass the selected files to the PHP for upload.</p>

                 <p>In this tutorial, I show how you can upload multiple files using Vue.js and PHP.</p>

                 <!-- Social Share buttons 3 -->
                 <div class="social-btn-sp">
                      {!! $shareButtons3 !!}
                 </div>
           </div>

     </div>
</body>
</html>

7. Demo

Xem Demo


8. Kết luận

Trong ví dụ, tôi đã sửa các liên kết nhưng bạn có thể đặt chúng động.

Tùy chỉnh thiết kế bằng cách sử dụng CSS và số lượng biểu tượng xã hội có thể nhìn thấy bằng bộ điều khiển.

Sử dụng gói Chia sẻ Laravel, bạn có thể chia sẻ các liên kết đến -

  • Facebook,
  • Twitter,
  • LinkedIn,
  • WhatsApp,
  • Reddit và
  • Telegram

Nguồn:  https://makitweb.com

#php #laravel 

Как добавить кнопку «Поделиться в социальных сетях» в Laravel 8

Пакет Laravel Share позволяет динамически генерировать кнопки социальных сетей из популярных социальных сетей, чтобы повысить вовлеченность в социальных сетях.

Это позволяет посетителям веб-сайта легко делиться контентом со своими социальными сетями и сетями.

В этом уроке я покажу, как вы можете добавить ссылки на социальные сети в свой проект Laravel 8, используя пакет Laravel Share.

1. Установить пакет

Установите пакет с помощью композитора —

composer require jorenvanhocht/laravel-share

2. Обновите app.php

  • Откройте config/app.phpфайл.
  • Добавьте следующее Jorenvh\Share\Providers\ShareServiceProvider::classв 'providers'
'providers' => [
      ....
      ....
      ....  
      Jorenvh\Share\Providers\ShareServiceProvider::class,
];
  • Добавьте следующее 'Share' => Jorenvh\Share\ShareFacade::classв 'aliases'
'aliases' => [
     .... 
     .... 
     .... 
     'Share' => Jorenvh\Share\ShareFacade::class,
];

3. Опубликовать пакет

Выполните команду -

php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"

4. Маршрут

  • Откройте  routes/web.php файл.
  • Создать маршрут –
    • / — Загрузить представление индекса.

Завершенный код

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PageController;

Route::get('/', [PageController::class, 'index']);

5. Контроллер

  • Создать  PageController контроллер.
php artisan make:controller PageController
  • Откройте  app/Http/Controllers/PageController.php файл.
  • Создать 1 метод –

index () — создайте ссылку для общего доступа, используя Share::page()и назначив $shareButtons1. Аналогичным образом создайте еще 2 ссылки и назначьте их переменным.

Загрузить indexпредставление и передать $shareButtons1, $shareButtons2и $shareButtons3.

Завершенный код

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
         public function index(){

               // Share button 1
               $shareButtons1 = \Share::page(
                     'https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Share button 2
               $shareButtons2 = \Share::page(
                     'https://makitweb.com/how-to-make-autocomplete-search-using-jquery-ui-in-laravel-8/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram();

               // Share button 3
               $shareButtons3 = \Share::page(
                      'https://makitweb.com/how-to-upload-multiple-files-with-vue-js-and-php/'
               )
               ->facebook()
               ->twitter()
               ->linkedin()
               ->telegram()
               ->whatsapp() 
               ->reddit();

               // Load index view
               return view('index')
                     ->with('shareButtons1',$shareButtons1 )
                     ->with('shareButtons2',$shareButtons2 )
                     ->with('shareButtons3',$shareButtons3 );
         }
}

6. Просмотр

Создать index.blade.php файл в  resources/views/ папке.

Включите Bootstrap, потрясающие шрифты CSS, jQuery и js/share.js. –

<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Share JS -->
<script src="{{ asset('js/share.js') }}"></script>

Добавлен CSS для настройки ссылок на социальные сети.

Отображать ссылки на социальные сети, используя –

{!! $shareButtons1 !!}

Точно так же отобразите другие 2 — {!! $shareButtons2 !!} и {!! $shareButtons3 !!}.

Завершенный код

<!DOCTYPE html>
<html>
<head>
     <title>Add social share button in Laravel 8 with Laravel Share</title>

     <!-- Meta -->
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <!-- CSS -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

     <!-- Share JS -->
     <script src="{{ asset('js/share.js') }}"></script>

     <style>
     #social-links ul{
          padding-left: 0;
     }
     #social-links ul li {
          display: inline-block;
     } 
     #social-links ul li a {
          padding: 6px;
          border: 1px solid #ccc;
          border-radius: 5px;
          margin: 1px;
          font-size: 25px;
     }
     #social-links .fa-facebook{
           color: #0d6efd;
     }
     #social-links .fa-twitter{
           color: deepskyblue;
     }
     #social-links .fa-linkedin{
           color: #0e76a8;
     }
     #social-links .fa-whatsapp{
          color: #25D366
     }
     #social-links .fa-reddit{
          color: #FF4500;;
     }
     #social-links .fa-telegram{
          color: #0088cc;
     }
     </style>
</head>
<body>

    <div class='container'>

         <!-- Post 1 -->
         <div class='row mt-5'>
               <h2>Datatables AJAX pagination with Search and Sort in Laravel 8</h2>

               <p>With pagination, it is easier to display a huge list of data on the page.</p>

               <p>You can create pagination with and without AJAX.</p>

               <p>There are many jQuery plugins are available for adding pagination. One of them is DataTables.</p>

               <p>In this tutorial, I show how you can add Datatables AJAX pagination without the Laravel package in Laravel 8.</p>

               <!-- Social Share buttons 1 -->
               <div class="social-btn-sp">
                     {!! $shareButtons1 !!}
               </div> 
          </div>

          <!-- Post 2 -->
          <div class='row mt-5'>
                 <h2>How to make Autocomplete search using jQuery UI in Laravel 8</h2>

                 <p>jQuery UI has different types of widgets available, one of them is autocomplete.</p>

                 <p>Data is loaded according to the input after initialize autocomplete on a textbox. User can select an option from the suggestion list.</p>

                 <p>In this tutorial, I show how you can make autocomplete search using jQuery UI in Laravel 8.</p>

                 <!-- Social Share buttons 2 -->
                 <div class="social-btn-sp">
                        {!! $shareButtons2 !!}
                 </div>
           </div>

           <!-- Post 3 -->
           <div class='row mt-5 mb-5'>
                 <h2>How to upload multiple files with Vue.js and PHP</h2>

                 <p>Instead of adding multiple file elements, you can use a single file element for allowing the user to upload more than one file.</p>

                 <p>Using the FormData object to pass the selected files to the PHP for upload.</p>

                 <p>In this tutorial, I show how you can upload multiple files using Vue.js and PHP.</p>

                 <!-- Social Share buttons 3 -->
                 <div class="social-btn-sp">
                      {!! $shareButtons3 !!}
                 </div>
           </div>

     </div>
</body>
</html>

7. Демо

Посмотреть демо


8. Заключение

В примере я исправил ссылки, но вы можете установить их динамически.

Настройте дизайн с помощью CSS и количество отображаемых значков социальных сетей с помощью контроллера.

Используя пакет Laravel Share, вы можете делиться ссылками на:

  • фейсбук,
  • Твиттер,
  • LinkedIn,
  • ватсап,
  • Реддит и
  • Телеграмма

Источник:  https://makitweb.com

#php #laravel