Categories
CMS Magento Mastering Development

Update Magento2 Catalog Images on Swatch Selected

Basically i written my own gallery page so when ever a configurable product with color swatches is available , it is not showing different color images when user selects that particular swatch. <?php /** * * */ /** * Product media data template * * @var $block */ $gallery_images = json_decode($block->getGalleryImagesJson()); $_product = $block->getProduct(); $videoFile=$_product->getData(‘agreement_file’); […]

Categories
Mastering Development

Laravel’s “logout other devices” feature not working

I’ll try to be brief. Happy quarantine everybody. I’m using Laravel 6.0.4. I was asked to logout users from all devices whenever they log in from a new location. Supposedly, Laravel makes this very easy with this: https://laracasts.com/series/whats-new-in-laravel-5-6/episodes/7 public function logoutOtherDevices($password, $attribute = ‘password’){ … } I can see that the code changes the password […]

Categories
Mastering Development

Angular Larevel JWT get authenticated user

I’m developing an Angular + Laravel app. I did a register-login with JWT and it works fine, i get the token and i store it in localStorage, the log out works too. But i have a problem with identifying the logged user. The me function is always returning a null json, why ? I searched […]

Categories
Development

assignRole() to customer alongside web and api guard in spatie permission

I have a guard name customer and also role name customer. to assign role in customer role. Error is There is no role named `customer`. Code is $user = User::find(58); $user->assignRole(‘customer’); return ”; Auth.php ‘guards’ => [ ‘web’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘users’, ], ‘customer’ => [ ‘driver’ => ‘session’, ‘provider’ => […]

Categories
Development

laravel auth:api returns SQLSTATE[42S22]: Column not found: 1054

Postman rertun this error Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘api_token’ in ‘where clause’ (SQL: select * from users where api_token = B6eJj892tHBKvX186BYZgmqqqG8Iz4npy85ArvJS80boCT4UYNBD5CGDIdG6Dm5nlSi83cY3n0XTvsxj and users.deleted_at is null limit 1) in file /var/www/html/myapp/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669 My column name in my table is token. I’ve also configured my storage_key in config/auth.php ‘guards’ => [ […]

Categories
Development

Custom multi-auth guard to enable student login

I’m developing a Laravel 6 app with 4 different users(with a different table for each). For this, I am using multi auth guard and created my first guard following this tutorial online (https://pusher.com/tutorials/multiple-authentication-guards-laravel). Here is my custom guard “student” ‘guards’ => [ ‘web’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘users’, ], ‘api’ => [ […]

Categories
Development Vue

Cannot redefine property: $router, possible duplication of Vue.use(VueRouter)

I have a few routes in my Vue App. However, refreshing the page will cause never ending loop only in particular 2 routes. The error that I received from chrome console is VM10283:55826 Uncaught TypeError: Cannot redefine property: $router at Function.defineProperty (<anonymous>) at Function.install (<anonymous>:55826:10) at Function.Vue.use (app.js:62595) at Module../node_modules/vue-router/dist/vue-router.esm.js (<anonymous>:57490:14) at __webpack_require__ (<anonymous>:20:30) at […]