laravel-5.4

Laravel Flysystem WebDav list directory

大城市里の小女人 提交于 2021-01-28 10:10:49
问题 I'm trying to get list of directory on WebDav through Flysystem however is it empty. I'm using Laravel Graham's Campbell integration of Flysystem: dump(Flysystem::listContents('test')); gives me empty array while dump(Flysystem::read('/test/test2.txt')); gives me content of file. Could you please help me understand what I'm doing wrong? Thank you! 来源: https://stackoverflow.com/questions/45993733/laravel-flysystem-webdav-list-directory

Laravel 5.4 required if validation issue

两盒软妹~` 提交于 2021-01-28 09:50:52
问题 I have 2 fields, accepts_usd and price_usd. For price usd I have a validation rule: 'price_usd'=>'integer|required_if:accepts_usd,1', And for accepts_usd: 'accepts_usd'=>'boolean|required', When I want to store data if I set accepts_usd to false it still asks for price_usd. whats the issue here? What am I doing wrong? 回答1: you need to change your code to 'price_usd'=>'integer|required_if:accepts_usd,==,1', 回答2: From laravel docs: required_if:anotherfield,value,... The field under validation

Laravel 5.4 required if validation issue

非 Y 不嫁゛ 提交于 2021-01-28 09:43:28
问题 I have 2 fields, accepts_usd and price_usd. For price usd I have a validation rule: 'price_usd'=>'integer|required_if:accepts_usd,1', And for accepts_usd: 'accepts_usd'=>'boolean|required', When I want to store data if I set accepts_usd to false it still asks for price_usd. whats the issue here? What am I doing wrong? 回答1: you need to change your code to 'price_usd'=>'integer|required_if:accepts_usd,==,1', 回答2: From laravel docs: required_if:anotherfield,value,... The field under validation

how can I check my old password with new password

放肆的年华 提交于 2021-01-28 07:56:55
问题 I am using bcrypt() function for storing my password of a user. Now if a user wants to change his/her password, then he/she will put his old password and I will check that with old password. Problem is whenever I am using bcrypt function to the user inputed password it shows some new generated password. Ex: During registration a user registered with 111111 password. And during change password the user also inputing 111111 but the both comes different. Q: Why it shows different. I am using

Laravel Socialite - Save URL before redirection

匆匆过客 提交于 2021-01-28 03:18:58
问题 I'm using Laravel 5.4 and Socialite so my users can log in with Facebook . My website works with subdomain newyork.example.com , paris.example.com example.com The Facebook URL redirect for the callback login has to be absolute so I set http://example.com login/facebook public function redirectToProvider() { $_SESSION['originalURL'] ="http://paris.example.com"; return Socialite::driver('facebook') ->scopes(['rsvp_event', 'public_profile']) ->redirect(); } login/facebook/callback public

Select SUM from subquery while using whereHas in Laravel

一个人想着一个人 提交于 2021-01-20 11:51:48
问题 I have 2 tables, customers and customer_invoices , and I want to get all the customers with a condition on their invoices, and select specific columns (customers.id, customers.last_name, and the sum of the total_price of the invoices for each customer), I have this query : $result = Customer::whereHas('customerInvoices', function(Builder $q) { $q->where('customer_invoices.status', 1); })->select([ 'customers.id', 'customers.last_name', \DB::raw('SUM(customer_invoices.total_price) as sum') ])-

Laravel image not shown on server and working fine on my local machine

岁酱吖の 提交于 2021-01-05 10:48:18
问题 On my local machine project working file but when i uploaded on my server then all images are not shown, and NotFoundHttpException error when i hit full image path to browser. mypath to project is as /public_html/offlinemall/public And Below is my filesystems.php 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [

Laravel: Seeding multiple unique columns with Faker

末鹿安然 提交于 2020-12-30 06:36:28
问题 Introduction What up folks, I got a question about model factories and multiple unique columns: Background I have a model named Image. This model has language support stored in a separate model, ImageText . ImageText has an image_id column, a language column and a text column. ImageText has a constraint in MySQL that the combination image_id and language has to be unique. class CreateImageTextsTable extends Migration { public function up() { Schema::create('image_texts', function ($table) { .

Laravel: Seeding multiple unique columns with Faker

旧街凉风 提交于 2020-12-30 06:33:46
问题 Introduction What up folks, I got a question about model factories and multiple unique columns: Background I have a model named Image. This model has language support stored in a separate model, ImageText . ImageText has an image_id column, a language column and a text column. ImageText has a constraint in MySQL that the combination image_id and language has to be unique. class CreateImageTextsTable extends Migration { public function up() { Schema::create('image_texts', function ($table) { .

SQLSTATE[HY000]: General error: 1364 Field 'branch_id' doesn't have a default value laravel 5.4

社会主义新天地 提交于 2020-12-14 11:10:31
问题 Hello guys I need your help. I am a beginner in laravel 5.4. I am trying to add a field which is foreign key however it doesn't added and produce the error doesn't have a default value. Add view Then the error UsersController code: public function create() { $branches = Branch::pluck('name', 'id'); return view('users.create', ['branches' => Branch::all()]); } public function store(Request $request) { $this->validate($request, [ 'branch_id' => 'required', 'fname' => 'required', 'lname' =>