laravel-5.5

Laravel How to remove “api” Prefix from subdomain URL

痴心易碎 提交于 2019-12-04 20:54:48
问题 I have created a Laravel application which is both Web application and provides REST APIs to android and iOS platforms. I have two route files one is api.php and other is web.php and routes\api.php routing as follows: routes/api.php Route::group([ 'domain'=>'api.example.com', function(){ // Some routes .... } ); and nginx serve blocks configured can be seen here server { listen 80; listen [::]:80; root /var/www/laravel/public; index index.php; server_name api.example.com; location / { try

Getting error while installing laravel installer in window 10

空扰寡人 提交于 2019-12-04 19:57:09
问题 I am using Windows 10 and composer is installed. When I try to install laravel installer globally using this command: composer global require laravel/installer [Composer\Downloader\TransportException] The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. It means

Laravel 5.5 Validate multiple file upload

天大地大妈咪最大 提交于 2019-12-04 17:32:34
How do I validate multiple file uploads using only one validation on laravel? $this->validate($request, [ 'project' => 'required|exists:project_details,id', 'location' => 'exists:project_details,location', 'plant_id' => 'exists:project_details,plant_id', 'capacity' => 'required|max:20', 'brief_description' => 'nullable|max:300', 'incident_details' => 'required|max:300', 'other_comments' => 'nullable|max:300', 'attachments.*' => 'required|file|mimes:xlsx,xls,csv,jpg,jpeg,png,bmp,doc,docx,pdf,tif,tiff' ]); I'm trying to validate the attachments. Here's my form: <input type="file" name=

Laravel 5.5 Validation change format of response when validation fails

不问归期 提交于 2019-12-04 13:20:50
In Laravel 5.4, we created a class that all our requests for validation inherited because we needed to customize our response. class APIRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return false; } /** * Response on failure * * @param array $errors * @return Response */ public function response(array $errors) { $response = new ResponseObject(); $response->code = ResponseObject::BAD_REQUEST; $response->status = ResponseObject::FAILED; foreach ($errors as $item) { array_push($response->messages,

Customising Laravel 5.5 Api Resource Collection pagination

橙三吉。 提交于 2019-12-04 12:26:23
问题 I have been working with laravel api resource. By default laravel provides links and meta as shown below. "links": { "first": "https://demo.test/api/v2/taxes?page=1", "last": "https://demo.test/api/v2/taxes?page=4", "prev": null, "next": "https://demo.test/api/v2/taxes?page=2" }, "meta": { "current_page": 1, "from": 1, "last_page": 4, "path": "https://demo.test/api/v2/taxes", "per_page": 2, "to": 2, "total": 8 } But I don't want this, insted i want something like "pagination": { "total": 8,

Laravelcollective/html not working in Laravel 5.5

自闭症网瘾萝莉.ら 提交于 2019-12-04 10:47:39
I've tried to use the Laravelcollective/html on laravel 5.5 by loading the v5.4 in my composer.json file but that didn't work. This is the code in the composer.json file: "laravelcollective/html":"^5.4.0", and loading it into my app configuration file app.php : inside the providers array Collective\Html\HtmlServiceProvider::class, But after i used the blade code to create the form it didn't work, here's the blade code. {!! Form::open(['route' => 'posts.store']) !!} {{Form::label('title','Title:')}} {{Form::text('title', null, array('class' => 'form-control') )}} {!! Form::close() !!} In

Run laravel project in localhost

雨燕双飞 提交于 2019-12-04 09:47:38
I have installed laravel by composer create-project laravel/laravel –-prefer-dist after this run php artisan serve command to laravel project directory and get this result. Laravel development server started: http://127.0.0.1:8000 But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error This site can’t be reached 127.0.0.1 refused to connect. but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project. Naincy Try to run in different port php artisan serve --port=9000 and then try http://127.0.0.1

How to solve Exception It is unsafe to run Dusk in production in laravel 5.5?

孤人 提交于 2019-12-04 05:22:57
I upgrated my project from laravel 5.4 to laravel 5.5 , I dont have any problem in local env but in server i get this exception , I searched a lot and i know this issue may be duplicated but no solutions solved my problem! How can i not registering dusk when environment is production? i wrote this code in AppServiceProvider.php : public function register() { // Dusk, if env is appropriate if ($this->app->environment('local', 'testing')) { $this->app->register(DuskServiceProvider::class); } } but it seems not working. can anyone help? EDITED : my composer.json file: "require-dev": { "filp

Class ' Form' not found in view-file.blade.php

坚强是说给别人听的谎言 提交于 2019-12-04 03:50:15
问题 I'm trying to render a text input field in my view file. I keep getting this error: "Class 'form' not found in view-file.blade.php" Template: @extends('layouts.app') @section('content') <h1>New</h1> {{ Form::open() }} {{ Form::text('my-name') }} {{ Form::close() }} @endsection Composer.json "require": { "php": ">=7.0.0", "fideloper/proxy": "~3.3", "laravel/framework": "5.5.*", "laravel/tinker": "~1.0", "laravelcollective/html": "^5.5.0" }, app.php (config) 'providers' => [ /* * Laravel

How to open file from storage by URL address?

大憨熊 提交于 2019-12-04 02:21:53
问题 I store files in storage. No I tried to generate link that open file like: http://[temp.com]/storage/tests/de139607636857fade861a3c2c472643.txt But it does not work. How to open file from storage by URL address? 回答1: Files in the storage are not accessible by url by default You could use Public Disk. For that you need to create symbolic link from public/storage to storage/app/public From Larvel 5.3 and up, you have artisan command that will help you to create symlink php artisan storage:link