laravel-5.6

Laravel: How to authenticate users without DB

限于喜欢 提交于 2019-12-18 05:58:13
问题 In short, is it possible to authenticate without DB (instead, using User Provider)? I've seen posts about how to authenticate without password , but would it be ever possible to authenticate without DB ? Here is what I've been trying to achieve... Ask the user to submit a PIN Compare the PIN with a value within .env If the PIN is correct, authenticate the user It seems to be possible to do authenticate without a traditional RDBMS by introducing a user provider. However, the doc doesn't seem

Laravel use multiple where and sum in single clause

蓝咒 提交于 2019-12-18 05:26:06
问题 in my database i have instagram_actions_histories table which into that i have action_type column, in the column i have unlike data such as 1 or 2 or 3 i'm trying to get this table data in relation ship and summing this values which stored in column, for example $userAddedPagesList = auth()->user()->instagramPages()->with([ 'history' => function ($query) { $query->select(['action_type as count'])->whereActionType(1)->sum('action_type'); } ] )->get(); btw, this code is not correct, in that i

How can I make default page number to every sheet on maatwebsite?(laravel-excel)

混江龙づ霸主 提交于 2019-12-17 21:18:30
问题 I use laravel 5.6, php 7.1 and maatwebsite 3.1 My script to display page number like this : $event->sheet->getHeaderFooter()->setOddFooter('&R&P'); It works. But my problem is I have 3 sheet. On the every sheet display page number start of 1 I want in the sheet 1, it display page number 1-3. In the sheet 2, it will display page number 4-6. And the sheet 3, it display page number 7-9 I want like that. I had searching reference, but I don't find it Please help me to solve this problem. I need

Laravel installer keeps installing 5.5 instead of 5.6

…衆ロ難τιáo~ 提交于 2019-12-17 16:58:17
问题 I installed php 7.2.2 / apache 2.4 and mysql-5.7 on windows 10. I want to install laravel 5.6 first: 1. composer clear-cache 2. composer update 3. composer global require "laravel/installer" php -v: PHP 7.2.2 (cli) (built: Jan 31 2018 19:31:17) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies and Laravel Installer 2.0.1 I try this (according to the laravel doc 5.6): composer create-project --prefer-dist

How can I convert many statement mysql to laravel eloquent?

做~自己de王妃 提交于 2019-12-17 02:52:07
问题 Mysql query like this : SELECT GROUP_CONCAT(DISTINCT CONCAT( 'ifnull(SUM(case when location_code = ''', location_code , ''' then quantity end),0) AS `', location_code , '`' ) ) INTO @sql FROM item_details; SET @sql = CONCAT('SELECT item_number,SUM(quantity) as "total_quantity", ', @sql, ' FROM item_details GROUP BY item_number'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; I want to convert it to laravel eloquent, but i'm confused. Because there exist many statement. There

How do I upload files on 2 folders at once in one method on the laravel?

霸气de小男生 提交于 2019-12-14 03:16:02
问题 I use laravel 5.6 I want to upload files on 2 folders at once. So if the image uploaded successfully in the product folder, I want the image uploaded in the thumbs folder as well I try like this : public function uploadImage($file) { if($file) { $fileName = str_random(40) . '.' . $file->guessClientExtension(); } $destinationPath = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'product'; if(!File::exists($destinationPath)) { File:

policy returns This action is unauthorized no matter what

醉酒当歌 提交于 2019-12-13 09:40:07
问题 i am just trying to show a company to anyone who ants to see it authServiceProvider: Company::class => CompanyPolicy::class , 'App\Models\Company' => 'App\Policies\CompanyPolicy', companyPolicy public function view( Company $company) { return true ; } companyController public function __construct(CompanyRepository $companies) { $this->companies = $companies; } public function show(Company $company) { $this->authorize('view', $company); return $this->companyRepository->show($company); } route

Is it possible to join table as below in Laravel?

别来无恙 提交于 2019-12-13 07:57:44
问题 how can I join two tables with multiple columns in laravel, somthing like the below query: SELECT * FROM tab1 AS e INNER JOIN tab2 AS v ON v.Case1 = e.Case1 and v.id = e.id; I have searched in google but could not find any way. This is the code I've tried so far: DB::table('tab1 as e') ->join('tab2 as v', 'v.Case1', '=', 'e.Case1', 'and', 'v.id', '=', 'e.id') ->get(); 回答1: Have you tried the following? DB::table('tab1 as e') ->join('tab2 as v', function($join) { $join->on('v.Case1', '=', 'e

After installing Laravel version 5.6 via composer and windows 10 show me 5.5.32 [duplicate]

岁酱吖の 提交于 2019-12-13 03:38:23
问题 This question already has answers here : Laravel installer keeps installing 5.5 instead of 5.6 (2 answers) Closed last year . I trying to install last version (5.6) of Laravel project but after install that, It was not version 5.6 but it is 5.5.32 !!! I installed composer on my windows 10 and I did run composer global require "laravel/installer" and composer create-project --prefer-dist laravel/laravel blog according to https://laravel.com/docs/5.6/installation But when checking laravel

Display in v-for laravel-vue

ε祈祈猫儿з 提交于 2019-12-13 03:14:08
问题 EDITED: I'm using Vue.js and I'm having an issue that my object JSON-string doesn't show. The problem is the object string doesn't display in v-for. JS var app = new Vue({ el: '#ob-rapper', data:{ items:[], }, mounted: function mounted(){ this.getVueItems(); }, methods:{ getVueItems: function getVueItems() { var _this = this; axios.get('/viewrequestsample').then(function (response) { _this.items = response.data; }); } } }); Controller: public function viewRequestSample(){ $data = OBMaster: