2018-10-22         Hilda

How to use curl with xampp in windows?

I am facing issue in testing laravel API while using curl.I am following tutorial https://www.toptal.com/laravel/restful-laravel-api-tutorialWhen I use command on CMD, I get error.The command is: curl -X POST localhost/api/register \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"name": "John", "email": "john.doe@toptal.com", "password": "toptal123", "password_confirmation": "toptal123"}'The error is:<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta http-equiv="refresh" content="1;url=http://localhost" /&...

 laravel                     1 answers                     59 view
 2018-10-22         Ina

Safari adds "localhost" in front of all URLs, why?

First, a disclaimer: The nature of this problem forces me to publish an affiliate link (to a german fashion shop) here. This is NOT a shady attempt to trick people into using the shop behind, I just need advice in a serious URL breaking problem. The link is classic affiliate, NOT pay-by-click or so. Hope this is clear :)My problem: I'm using affiliate links on a project which I get directly from certain online shops. The links always work fine in all browsers, except safari.Example link: https://partners.webmasterplan.com/click.asp?ref=839072&site=7270&type=text&...

 laravel                     1 answers                     63 view
 2018-10-22         Benedict

Second page of pagination link is sending to original page in laravel

I have a form for searching data on search.blade.php (url :/search) and sending result to another view on the same URL.when I click on the 2nd link of Pagination Link bar(2 in the image) then it redirects from /search to /search?page=2 and no data display.$users= DB::table('user')->select('first_name','last_name')->where('city',$city)->groupby('user')->paginate(5);return view('search_result',['users' => $users]); Don't use group by for pagination. [XXX]

 laravel                     1 answers                     48 view
 2018-10-22         Mandy

Checkbox doesn't save true value

I'm using Laravel 5.6 and Vuejs 2.If I click on my checkbox and make the value true it's supposed to save a 1 in the database and if I click my checkbox and make the value false it saves a 0.The problem I'm having is that if I click my checkbox and make it true, it doesn't save the correct value, no changes is made to the database and I don't get any errors. If I click on my checkbox and make it false, it saves the 0 correctly.I did notice that even when my value is supposed to be true, I do get a false when I dd($category->has('active')I'm not sure where I'm going wrong...

 laravel                     2 answers                     82 view
 2018-10-22         Gabrielle

Undefined Index:email Error In Laravel 5.6

I want to make login functionality for my website. But unfortunately it is giving undefined Index:email in my AdminController:public function login(Request $request){ if($request->isMethod('post')) { $data = $request->input(); if (Auth::attempt(['email' => $data['email'], 'password' => $data['password'],'admin' => '1'])) { echo "Success"; //console.log("Successfull"); die; } else { echo "Failed"; //console.log("Failed...

 laravel                     1 answers                     83 view
 2018-10-22         Brady

Laravel on kubernetes - slow composer vendor autoload (production)

We have set up a kubernetes cluster for our laravel application on google cloud platform.Containers:application code + php-fpmapache2others not related to the issue(We run under nginx-ingress-controller but this seems unrelated to the issue)We run a jmeter stress tests on a simple laravel route that returns "ok" and we noticed terrible response times.Afterwards we run the same test on an index2.php (inside public dir το slide over the framework) which just returns 'ok'. And we got this result(!):After digging we found out that the composer's autoloading stuff cause this sl...

 laravel                     1 answers                     86 view
 2018-10-22         Jerome

Laravel relationship sum on appends attribute

i have two modelthis is my material model:<?phpnamespace App;use Illuminate\Database\Eloquent\Model;class material extends Model{ protected $fillable = ['proposal_id','thickness','width','length','qty','description']; public $timestamps = false; protected $appends = ['total']; public function proposal() { return $this->belongsTo(proposal::class); } public function getTotalAttribute() { return $this->qty * $this->price; }}this is my proposal model:<?phpnamespace App;use Illuminate\Database\Eloquent\Model;class proposal ...

 laravel                     1 answers                     87 view
 2018-10-22         Poppy

Laravel 5.7 Installation Issue

I'm trying to install laravel 5.7 by using this command> composer create-project --prefer-dist laravel/laravel new_project dev-developBut it's reflecting following error, also i disabled antivirus and firewall. Installing laravel/laravel (dev-develop b0651d2467f1428eadc505e1b3b4f5678611927c) - Installing laravel/laravel (dev-develop develop): Loading from cache Created project in new_project @php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies (including require-dev) Pac...

 laravel                     4 answers                     43 view
 2018-10-22         April

Cannot access files uploaded by Dropzone.js in Laravel Controller

There is a model called Image and it has a file, title, photographer and etc. I need to let the users to upload multiple images, then display the form of other fields for each image. So I chose Dropzone and I need to do it without Ajax upload. This is the form @extends('layouts.layout')<link rel="stylesheet" href="{{asset('css/dropzone.css')}}" />@section('content') <div class="container"> <div class="row"> <div class="col-md-12 text-right"> <div class="widget"> <div class="widget-header...

 laravel                     1 answers                     45 view
 2018-10-22         Mandy

relationship of an instantiated class - Laravel/Eloquent

I'm working on an api for a website, where I have the tables of blogs and categoriesevery blog belongs to categoryand each category has many blogsOK?So, I created a BlogController and configured the routes to access the corresponding function./api/blog/ url via GET is redirected to the index function of my controller, and the function looks like this:public function index(){ $blog = Blog::with('category')->get(); return response()->json($blog, 200);}which returns this (correct)[ { "id": 1, "title": "title from blog", "body": "texto do meu...

 laravel                     1 answers                     46 view
 2018-10-22         Antony

laravel replicate() method and computed database column

I'm trying to copy a row using by replicate() method:$doc = Doc::find(64618);$newdoc = $doc->replicate();$newdoc->Price= 9999; $newdoc->save();but this table contains several computed columns and I get an error that the data fields can not be updated.How can I exclude these fields when using replicate()? You can pass the columns that you want to excludes$doc = Doc::find(64618);$newdoc = $doc->replicate(['column1', 'column2']);$newdoc->Price= 9999; $newdoc->save();Here is the source you will find out if u deep dive into the core./** * Clone the model...

 laravel                     1 answers                     51 view
 2018-10-22         Brady

Laravel: Expression #3 of SELECT list is not in GROUP BY (Querying a Many-to-Many relationship)

I got a project with the Models Menu and User, which are in a Many-to-Many relationship.On one site I show the past menus per calender week, on the other I want to show the order history of a specific user per calender week.I got the menu history working with the following query:public static function archives() { return Menu::selectRaw('week(date, 1) as kw, year(date) as year') ->orderByRaw('min(date) asc') ->groupBy('kw', 'year') ->get(); }Now i thought about the same query for the User, but I get errors ...

 laravel                     1 answers                     52 view
 2018-10-22         Jerome

Laravel Many to many relationship with custom key relation

Before you mark this question as duplicate, please see the details :) I have a problem related to many to many relationship with custom columns linkingI have following tables Employees -Id -brink_id <----- This is third party id I am saving of employee -nameJobs-id-brink_id <----- This is third party id I am saving of job-descriptionemployee_job-id-brink_id <----- This is third party id I am saving of relationship for third party-brink_employee_id-brink_job_idIn Employee Model I have created relationshippublic function jobs(){ return $this->belongsToMany('App...

 laravel                     1 answers                     53 view
 2018-10-22         Spring

Responses JSON with Relationship - Laravel/Eloquent

I'm working on a Laravel project and I want to create a REST API for a website. On my system, I have two tables:Blogs and Categories. The table blogs have the category_id column, which is a key that references the column ID in the category table.Blogs Migrationclass CreateBlogsTable extends Migration{ public function up() { Schema::create('blogs', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->longtext('body'); $table->string('category_id'); $table->timestamps(); }); } .....}Catego...

 laravel                     3 answers                     55 view
 2018-10-22         Elton

Delete related model correctly

My store function ispublic function store(Request $request, Post $post){ $comment = new Comment(); $comment->fill($request->all()); $post->comments()->save($comment);}And my destroy function ispublic function destroy(Post $post, Comment $comment){}Store function I got from documentation (Inserting & Updating Related Models)So what is the best practice to delete a comment through the Post model? Since your relationships are hasMany and belongsTo, you don't really need to delete a comment through a post. The comment exists as its own record in its ...

 laravel                     2 answers                     58 view
 2018-10-22         Tina

Laravel get routes by method

How can I get all routes in project which have GET method? I have tried:Route::getRoutes() which gave me all routes but somehow I could not have filtered them by method.The Route::getRoutes()->routes would be nice to have but routes is protected property and I do not see any getter. you can create small helper method.function getRoutesByMethod(string $method){ $routes = \Route::getRoutes()->getRoutesByMethod(); return $routes[$method];}then use it in your application$postRoutes = getRoutesByMethod("POST"); [XXX]The RouteCollection has a method to sort the ...

 laravel                     2 answers                     60 view

Page 1 of 489  |  Show More Pages:  Top Prev Next Last