laravel5.7 passport

composer require laravel/passport
php artisan migrate
php artisan passport:install

app/User.php

<?php

namespace App;

use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}

app/Providers/AuthServiceProvider.php

<?php

namespace App\Providers;

use Laravel\Passport\Passport;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Passport::routes();
    }
}

config/auth.php

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],

laravel5.7 redis socket.io

composer require predis/predis

.env

BROADCAST_DRIVER=redis

config/app.php

取消注释providers下App\Providers\BroadcastServiceProvider::class,

创建文件app/Events/ChatRoom.php

<?php

namespace App\Events;

use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class ChatRoom implements ShouldBroadcast
{

    public $data;
    private $channels;
    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($channels, $data)
    {
        //
        $this->channels = $channels;
        $this->data = $data;
    }

    /**
     * Get the channels the event should be broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return $this->channels;
    }
}

调用

use Event, App\Events\ChatRoom;

Event::fire(new ChatRoom($channel, ‘data’));

RN-常用第三方组件

ListView的优化
https://github.com/sghiassy/react-native-sglistview

调用系统打电话、发短信、发邮件、打开网址功能
https://github.com/anarchicknight/react-native-communications

图表组件
https://github.com/tomauty/react-native-chart

动画组件
https://github.com/oblador/react-native-animatable

左右滑动出现按钮
https://github.com/dancormier/react-native-swipeout
npm install –save react-native-swipeout

侧滑按钮
https://github.com/dancormier/react-native-swipeout
https://github.com/jemise111/react-native-swipe-list-view

热更新
https://github.com/Microsoft/react-native-code-push

热更新(似乎更好)
https://github.com/aerofs/react-native-auto-updater

热更新(中国人写的)
https://github.com/fengjundev/React-Native-Remote-Update

列表下拉刷新
https://github.com/syrusakbary/react-native-refresher

下拉刷新和加载更多
https://github.com/FaridSafi/react-native-gifted-listview

左侧菜单与官方的DrawerLayoutAndroid 用法相同,兼容iOS
https://github.com/iodine/react-native-drawer-layout

条码扫描
https://github.com/ideacreation/react-native-barcodescanner

二维码
https://github.com/ideacreation/react-native-barcodescanner

扫描二维码
https://github.com/lazaronixon/react-native-qrcode-reader

文件上传
https://github.com/kamilkp/react-native-file-transfer

支持Android和ios的toast
https://github.com/remobile/react-native-toast

获取设备各类信息
https://github.com/rebeccahughes/react-native-device-info

WebStorm ReactNative的代码模板插件,包括:
1.组件名称2.Api 名称3.所有StyleSheets属性4.组件属性
https://github.com/virtoolswebplayer/ReactNative-LiveTemplate

react-native调用cordova插件
https://github.com/axemclion/react-native-cordova-plugin

输入自动完成
https://github.com/FaridSafi/react-native-google-places-autocomplete

抖一抖动画小组件(有点意思)
https://github.com/slavik0329/react-native-bounceable

封装后动画组件(效果较丰富)
https://github.com/oblador/react-native-animatable

文件上传
https://github.com/aroth/react-native-uploader

jpush-react-native //官方版本
https://github.com/jpush/jpush-react-native

react-native-jpush 由 React Native 中文网开发维护。
https://github.com/reactnativecn/react-native-jpush

选项卡 https://github.com/exponentjs/react-native-tab-navigator

material组件库(各种漂亮的小组件)
https://github.com/xinthink/react-native-material-kit

base组件库(各种封装不错的小组件)
http://nativebase.io/docs/v0.4.6/components#anatomy
https://github.com/GeekyAnts/NativeBase

不错的按钮
https://github.com/mastermoo/react-native-action-button
https://github.com/ide/react-native-button

输入框表单验证
https://github.com/gcanti/tcomb-form-native
https://github.com/FaridSafi/react-native-gifted-form
https://github.com/bartonhammond/snowflake

炫酷效果的 TextInput
https://github.com/halilb/react-native-textinput-effects
https://github.com/zbtang/React-Native-TextInputLayout

聊天
https://github.com/FaridSafi/react-native-gifted-chat

地图
https://github.com/lelandrichardson/react-native-maps

动画
https://github.com/oblador/react-native-animatable

加载动画
https://github.com/maxs15/react-native-spinkit

抽屉效果
https://github.com/root-two/react-native-drawer
https://github.com/react-native-fellowship/react-native-side-menu

图表
https://github.com/tomauty/react-native-chart

下拉放大
https://github.com/lelandrichardson/react-native-parallax-view

可滑动的日历组件
https://github.com/cqm1994617/react-native-myCalendar

语言转化和一些常用格式转换
https://github.com/joshswan/react-native-globalize

单选多选ListView
https://github.com/hinet/react-native-checkboxlist

选择按钮
https://github.com/sconxu/react-native-checkbox

制作本地库
https://github.com/frostney/react-native-create-library

影音相关
https://github.com/MisterAlex95/react-native-record-sound

安卓录音
https://github.com/bosung90/react-native-audio-android

提示消息的Bar
https://github.com/KBLNY/react-native-message-bar

iOS原生TableView
https://github.com/aksonov/react-native-tableview

点击弹出视图
https://github.com/jeanregisser/react-native-popover
https://github.com/instea/react-native-popup-menu

3D Touch
https://github.com/madriska/react-native-quick-actions

双平台兼容的ActionSheet
https://github.com/beefe/react-native-actionsheet

照片墙
https://github.com/ldn0x7dc/react-native-gallery

键盘遮挡问题
https://github.com/reactnativecn/react-native-inputscrollview
https://github.com/wix/react-native-keyboard-aware-scrollview

本地存储
https://github.com/sunnylqm/react-native-storage

星星
https://github.com/djchie/react-native-star-rating

国际化
https://github.com/joshswan/react-native-globalize

通讯录
https://github.com/rt2zz/react-native-contacts

加密
https://www.npmjs.com/package/crypto-js

缓存管理
https://github.com/reactnativecn/react-native-http-cache

图片和base64互转
https://github.com/xfumihiro/react-native-image-to-base64

安卓 iOS 白屏解决
https://github.com/mehcode/rn-splash-screen

Text跑马灯效果
https://github.com/remobile/react-native-marquee-label

清除按钮的输入框
https://github.com/beefe/react-native-textinput

WebView相关
https://github.com/alinz/react-native-webview-bridge

判断横竖屏
https://github.com/yamill/react-native-orientation

PDF
https://github.com/cnjon/react-native-pdf-view

手势放大缩小移动
https://github.com/kiddkai/react-native-gestures
https://github.com/johanneslumpe/react-native-gesture-recognizers

下拉-上拉-刷新
https://github.com/FaridSafi/react-native-gifted-listview
https://github.com/jsdf/react-native-refreshable-listview
https://github.com/greatbsky/react-native-pull/wiki

下拉选择
https://github.com/alinz/react-native-dropdown

图片查看
https://github.com/oblador/react-native-lightbox

照片选择
https://github.com/marcshilling/react-native-image-picker
https://github.com/ivpusic/react-native-image-crop-picker

图片加载进度条
https://github.com/oblador/react-native-image-progress

轮播视图
https://github.com/race604/react-native-viewpager
https://github.com/FuYaoDe/react-native-app-intro
https://github.com/appintheair/react-native-looped-carousel
https://github.com/leecade/react-native-swiper

模态视图
https://github.com/maxs15/react-native-modalbox
https://github.com/brentvatne/react-native-modal
https://github.com/bodyflex/react-native-simple-modal

毛玻璃效果
https://github.com/react-native-fellowship/react-native-blur

头像库
https://github.com/oblador/react-native-vector-icons

滑动选项卡
https://github.com/skv-headless/react-native-scrollable-tab-view

倒计时,电商APP,秒杀、团购倒计时
https://github.com/jackuhan/react-native-CountDowntimer

可滚动标签,可以点击切换,每个 tab 可以有自己的 ScrollView,点击切换的时候可以维护自己的滚动方向。
类似网易新闻标签(首页)
https://www.npmjs.com/package/react-native-scrollable-tab-view

视频播放
npm install react-native-video –save

一款简单易用的 Toast 组件,支持 Android&iOS.
https://github.com/crazycodeboy/react-native-easy-toast?utm_source=tuicool&utm_medium=referral

react-native-banner-lite:RN 的一个开源的带有分页效果的半屏 Banner 组件
https://github.com/talisk/react-native-banner-lite
$ npm i react-native-banner-lite –save
import BannerLite from ‘react-native-banner-lite’;

点击弹出类似iOS复制、粘贴menu
react-native-tooltip
https://www.npmjs.com/package/react-native-tooltip

作者:精神病患者link常
链接:https://www.jianshu.com/p/9e1c359e9e93
來源:简书

在 MAC OS X 安装 ADB (Android调试桥)

什么是 ADB? 

Android调试桥( adb )是一个开发工具,帮助安卓设备和个人计算机之间的通信。 这种通信大多是在USB电缆下进行,但是也支持Wi-Fi连接。 adb 还可被用来与电脑上运行的安卓模拟器交流通信。 adb 对于安卓开发来说就像一把“瑞士军刀”。 

通过 Homebrew 安装 

brew install android-platform-tools

测试是否正常安装

 adb devices

react-native错误

xcrun: error: unable to find utility “instruments”, not a developer tool or in PATH
在终端执行如下命令 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

‘config.h’ file not found

cd node_modules/react-native/third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh

undefined is not an object (evaluating ‘RNFSManager.RNFSFileTypeRegular’)

react-native link react-native-fs

重新编译

Xcode 10 libfishhook.a cannot be found

:-1: Build input file cannot be found: ‘/…../node_modules/react-native/Libraries/WebSocket/libfishhook.a’

1、Project Navigator    2、Libraries    3、RCTWebSocket.xcodeproj    4、Build Phases    5、Link Binary With Libraries    6、删掉libfishhook.a,重新添加libfishhook.a

‘config.h’ file not found

cd node_modules/react-native/third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh