laravel

How to logout JWT token using Multi authentication with different table of User

一曲冷凌霜 提交于 2021-01-28 03:20:15
问题 Here is a code in config/auth.php 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'jwt', 'provider' => 'users', 'hash' => false, ], 'client' => [ 'driver' => 'jwt', 'provider' => 'clients', ] ], 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], 'clients' => [ 'driver' => 'eloquent', 'model' => App\Client::class, ], ], My login function doesnt have a problem with this code for different login user : config()-

Creating a sign up token for Laravel app from separate frontend app

那年仲夏 提交于 2021-01-28 03:13:16
问题 I'm creating an Angular app with a separate Laravel backend. I want to User auth, specifically User registration. I'm getting the following errors: Error from frontend app: No 'Access-Control-Allow-Origin' header is present on the requested resource. Error when trying to create new user from DHC: Endpoint: my_apps_api.localhost/api/auth/register Post Data: { "username" : "myusername" "password" : "12345" } TokenMismatchException in VerifyCsrfToken.php I think this is because I need to

Laravel Passport - Feature test returns unauthorized 401

倾然丶 夕夏残阳落幕 提交于 2021-01-28 03:06:00
问题 I'm trying to test my login endpoint where a successful response would return the access_token among other things. I'm using RefreshDatabase , so I changed the login method on the controller to retrieve the client_secret via a DB call. I tested with a dd() and I can confirm that the client_secret changes on each phpunit run in the terminal. The credentials are correct and the API endpoint works - just not when it's run via a test. For example, I have the passport tables set up on my mysql

Laravel Validation with or

﹥>﹥吖頭↗ 提交于 2021-01-28 02:55:50
问题 I have a laravel validation that needs to match one of the 3 regex's $validatedData = $request->validate([ 'BCH-address' => 'regex:/^([13][a-km-zA-HJ-NP-Z1-9]{25,34})/', 'BCH-address' => 'regex:/^((bitcoincash:)?(q|p)[a-z0-9]{41})/', 'BCH-address' => 'regex:/^((BITCOINCASH:)?(Q|P)[A-Z0-9]{41})$/', ]), Is there a way to use a OR condition for the validation?? 回答1: You can add rule https://laravel.com/docs/5.6/validation#using-rule-objects and there your logic, or use closure https://laravel

update laravel database by ajax

北城余情 提交于 2021-01-28 02:33:01
问题 Question How can I update only 1 column of my table with Ajax using checkbox? Explanation I want to use checkbox and update my active column, the value will be either 1 or 0 . If checked value is 1 otherwise 0 . Codes html <label class="switch"> <input type="checkbox" data-name="active" data-id="{{ $courier->id }}"> <span class="slider round"></span> </label> data-name is name of my column data-id is my row id controller function public function Updatecourierstatus(Request $request) { try {

guzzlehttp/guzzle dosn't work after update php to php 8

此生再无相见时 提交于 2021-01-28 02:13:28
问题 I use the guzzlehttp/guzzle package in Laravel 8 . After upgrading to PHP 8 , I get: Symfony\Component\ErrorHandler\Error\FatalError: Invalid opcode 117/2/0. in file ../vendor/defuse/php-encryption/src/Core.php on line 412 composer.json: "require": { "php": "^8.0", "doctrine/dbal": "^2.12.1", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^8.12", "laravel/passport": "^10.0", "laravel/tinker": "^2.5", "ext-json": "*" }, "require

How to enable or install PHP's mysql_xdevapi extension in WAMPServer to install datatable?

痴心易碎 提交于 2021-01-28 02:00:38
问题 I wanted to install DataTable in laravel, I used WAMPServer and my PHP version is 7.3.5, Mysql version 5.7.26. I follow many steps on the internet, such as download from pecl.php.net but my problem remain. When write composer require yajra/laravel-datatables-oracle:^9.0 in CMD, after wile the below error showed and cause installation stop. Error: problem1 -The requested PHP extension ext-mysql_xdevapi * is missing from your system. Install or enable PHP's mysql_xdevapi extension. 回答1: php

Microsoft graph Unable to read JSON request payload

僤鯓⒐⒋嵵緔 提交于 2021-01-28 01:53:00
问题 I'm trying to create subscriptions with microsoft graph in php, however I am unable to see what is going wrong at this point. The code is breaking at the following: protected $http_subscribe = "https://graph.microsoft.com/v1.0/subscriptions"; public function getSubscriptions() { if(empty($this->token)) { dd('no token supplied'); //some debugging } $date = $this->endTimeDate->format('Y-m-d'); //This is Carbon date $time = $this->endTimeDate->format('H:i:s.u'); $response = $this->client-

Filter categories on AND instead of OR basis in Laravel

与世无争的帅哥 提交于 2021-01-28 00:53:33
问题 I would like to filter journalists on the basis of the categories they write about (e.g. Sports, Music). When the user selects multiple categories, e.g. sports and music, it should show only the journalist which are writing about Sports AND Music. Currently, I have only managed to filter on journalists who are writing about Sports AND/OR Music. The categories selected by the user are represented in an array: And the combination journalists and category combination are defined in a linking

How to recieve image blob data by Cropper Js in laravel controller

我的未来我决定 提交于 2021-01-27 23:31:47
问题 I am working with cropper js and laravel, I cropped the image and put it into the formdata and send it to the Laravel controller by Jquery Ajax. The problem it that I do not get data in controller. but only get an error. the code is given below: HTML <button type="button" name="button" id="crop">Crop</button> <img src="{{asset('public/img/img.jpg')}}" id="image" alt="" style="height: 500px;"> Jquery and Cropper Js Code <script src="{{asset('public/js/jquery.min.js')}}"></script> <script src="