laravel-5.4

Laravel 5.4 - Validation with Regex [duplicate]

前提是你 提交于 2019-12-28 05:37:08
问题 This question already has answers here : Issue with Laravel Rules & Regex (OR) operator (3 answers) Closed 2 years ago . Below is my rule for project name: $this->validate(request(), [ 'projectName' => 'required|regex:/(^([a-zA-z]+)(\d+)?$)/u', ]; I am trying to add the rule such that it must start with a letter from a-z or A-z and can end with numbers but most not. Valid values for project name: myproject123 myproject MyProject Invalid values for project name: 123myproject !myproject

How can I install npm in laravel 5.4?

廉价感情. 提交于 2019-12-25 18:19:11
问题 When I use this command in command mode: D:\xampp\htdocs\profileApp>npm run dev I get this error: 'npm' is not recognized as an internal or external command, operable program or batch file. How can I solve this? 回答1: First of all, I assume you are a Windows user. In this case, you need to download and install NPM together with NodeJS from the official website. When installing, do not unselect the "Add to PATH variables" point. It's important that NPM is added to your PATH variables, so it's

insert child comments of parent post vue js

天大地大妈咪最大 提交于 2019-12-25 10:47:13
问题 i am using laravel 5.4 and vue 2.0. I need to insert comments of parent posts like facebook. I want to pass 'post id' from parent to child template to insert comments of that parent post. <div class="post-section" v-for="(post,index) in posts"> <div class="media-content" v-text='post.body'></div> <button @click="getComments(post, index)" class="btn btn-link">Comments</button> <div v-if='show' class="card comment" v-for='comment in post.comments'> <span>  {{comment.comment}}</span> </div>

What is wrong in the deploy of this Laravel application? Need I an effective domain instead the vhost used on my local environment?

拈花ヽ惹草 提交于 2019-12-25 09:39:44
问题 I am pretty new in PHP and moreover in Laravel and I am pretty desperate trying to deploy a Laravel 5.4 application that works fine on my local environment on my Linux remote server. So I think that it is something related to virtual host configuration or something like this (maybe also something related to the .htaccess file) In my local environment (I am using XAMPP on Windows) I have setted this virtual host into the C:\xampp\apache\conf\extra\httpd-vhosts.conf file: <VirtualHost *:80>

parse the html data to array data in php

感情迁移 提交于 2019-12-25 08:27:41
问题 I am trying to parse the html format data into arrays using the a tag classes but i was not able to get the desired format . Below is my data $text ='<div class="result results_links results_links_deep web-result "> <div class="links_main links_deep result__body"> <h2 class="result__title"> <a rel="nofollow" class="result__a" href="">Text1</a> </h2> <a class="result__snippet" href="">Text1</a> <a class="result__url" href=""> example.com </a> </div> </div> <div class="result results_links

Laravel fails to deserialize model with mysql's POINT column

被刻印的时光 ゝ 提交于 2019-12-25 04:59:12
问题 I have a model where column location represents coordinates. This column can be null. When it is null everything is fine, but when there is some data, then: If it is used inside internal laravel events (which does not implement ShouldBroadcast) then I have to add use SerializesModels , otherwise field is not deserialized, exception is thrown invalidPayloadException in Queue.php line 89 If it ised inside broadcast laravel events (which must be delivered into browser) then node.js fails to

Laravel 5.4 implicit route model binding with resource returns empty object

岁酱吖の 提交于 2019-12-25 04:29:16
问题 I'm stuck on a very odd issue with laravel's route model binding. Using a route resource: Route::resource('vendors', 'VendorController'); The route for editing an entry is the following: GET|HEAD | admin/vendors/{vendor}/edit | vendors.edit | App\Http\Controllers\VendorController@edit | web,auth.admin So from my understanding of implicit route model binding, the vendor attribute should allow accessing the object directly. In my Controller function I can get the actual id with no problem. But

Laravel passport 500 internal server error on EC2

家住魔仙堡 提交于 2019-12-24 19:17:26
问题 I'm building an app using Angular 2 (no known as 4) as frontend and Laravel 5.4 as API backend. I'm using Laravel's passport password grant feature to authenticate user access to API. The Frontend is not directly accessing oauth routes. My custom auth controller is talking to oauth/token to get the grant values. This setup is working perfectly fine in my local environment, but in AWS EC2 it throws 500 internal server error. I thought it could be related to GuzzleHttp\Client, but it was not.

using Request::is() function with named Routes Laravel

大城市里の小女人 提交于 2019-12-24 17:15:34
问题 I was doing Request::is('/') which gave me true for example.com Now I am using named routes and for the name welcome Route::get('/', function () { return view('admin_panel.welcome'); })->name('welcome'); Request::is(route('welcome')) returns false What should I do. Note: I am using this for active states in navigation 回答1: You can use the routeIs method: Request::routeIs('welcome'); 回答2: I achieved this using Request::url() == route('welcome') which gave me true for example.com 来源: https:/

Laravel symbolic link to storage

跟風遠走 提交于 2019-12-24 14:26:04
问题 I have some problems creating a symbolic link with laravel to access some images that are in my storage ... I store my images in the folder storage\app\public\clients where I have images 1.png, 2.png and so on ... I used the php artisan command to create the link php artisan storage: link The [public/storage] directory has been linked. now when i try to access in my view the following path does not work <img id = "thumbnail" src = "{{asset ('clients / 1.png')}}" width = "150px"> </ img> do I