Questions tagged [laravel]

48790 questions
1

votes
1

answer
356

Views

How to get url Cloudfront CDN in Laravel

I am using FileStorage from Laravel to store uploaded files. To get the url of a file I am using: $url = Storage::url('/test/image.jpg'); It does return the url of the file on Amazon S3, however I want it to return the url of the file on CDN CloudFront. How can I achieve this? Thanks all!
Quy Nguyen Vu
1

votes
0

answer
211

Views

HasManyThrough Polymorphic model or morphto without intermediary?

Consider the following Eloquent docs polymorphic example as a starting point: (https://laravel.com/docs/5.5/eloquent-relationships#polymorphic-relations) In this variation, it's a bit of a reverse direction. User hasMany Medias. Medias are polymorphic and can be any model. Goal is to be able to que...
eric
1

votes
0

answer
598

Views

Lumen Custom Authentication with custom Fields and Store in Auth Guard

I am using lumen for API development. I have an issue in Lumen Custom Authentication. I want to login a user when his credentials and account_name matches with stored record. In the credentials filed there is not username and password type data. here my login method public function login(Request $r...
Usman Hafeez
1

votes
0

answer
245

Views

How to pass FormData with Angular to Laravel action method

I have an existing site built using Laravel. I am 'duplicating' the action methods to use Angular, when I duplicated the action that posts a file I didn't get it to work. The $_FILES and $_POST global variables are not being set. Template: I have an input of type file, when a file is selected I wan...
Diego Alves
1

votes
0

answer
130

Views

Laravel - How can I authenticate users from cached user object in Laravel? (using JWT)

I'm using the Laravel Tymon package for JWT user authentication. I'm also caching every user object after a new user is created and saved in the database so that I can load the data faster on selects. The authenticate() method in the Tymon package takes the token as an input and uses the user model...
Ryan
1

votes
1

answer
331

Views

Laravel using Arabic characters as query parameters

I'm testing my Laravel Lumen API with Postman, my controller retrieve data from database using url query parameter like below $router->get('/ByName/{contactGov}', '[email protected]'); My url in Postman is http://localhost/apitest/public/ByName/BGD and every thing works fine but when i use Ara...
Ali Adil
1

votes
2

answer
149

Views

laravel - How to get data by pivot table

I have a problem with laravel. I have created relationships between tables and relationships at the model level in laravel but if I want to display data to the view, I get an error: Property [category] does not exist on this collection instance. the table with the films is called: videos the table w...
White Cat
1

votes
1

answer
763

Views

Laravel JWT Authentication without User Model

I'm trying to build a laravel application and API for mobile users in the same project. The main web is actually a backend of a website and require proper authentication that I have already implemented. And the api also need to authenticate but with different credentials (not user model from web). A...
AHSAN
1

votes
0

answer
41

Views

Why does a Capitalization error work locally…?

I've encountered this situation a couple of times now where everything is working fine locally, then when I push to remote server, I get errors due to simple Capitalization error. 'App\Useraction' vs 'App\UserAction The same error exists locally, so why does everything still work? Is there an Apac...
BizzyBob
1

votes
0

answer
338

Views

Rewrite URLs on Laravel Homestead

I'm making a web game. The backend is Lumen and the frontend is a single page application. I want to make a use of JavaScript History API, so all URIs (except for actual file or directory paths) should point to the same backend script. I know how to do it on Apache, but my local server is Laravel Ho...
Robo Robok
1

votes
0

answer
431

Views

PSR-4 Autoloading in Laravel

Working on an application that will be used to extend the Chatter package Issue is, I want to make modifications to the package but don't want to do is directly to the package. Changes won't persist after a composer update. Now from my understanding extending the package would require me to exclude...
sogeniusio
1

votes
0

answer
388

Views

How to set, Laravel Queue Payload format

How to set, Laravel Queue Payload format. I don't want to change the source code. source code: File Path: vendor\laravel\framework\src\Illuminate\Queue\Queue.php /** * Create a payload for an object-based queue handler. * * @param mixed $job * @return array */ protected function createObjectPaylo...
tom lee
1

votes
1

answer
264

Views

Laravel folder permission for not-yet made cache folders

I'm having an issue with directory permissions with Laravel when it comes to caching. Whenever it tries to upload a cache file to /var/www/laravel/storage/framework/cache/data/ it tells me that file_put_contents has no permissions. To fix this I always do something like chmod -R 755 /var/www/laravel...
P. Nick
1

votes
1

answer
54

Views

Laravel get only models with current version

I have implemented custom model versioning in Laravel Framework. There is couple of columns handling it in the database table: sibling_id (links model's different versions together), version, accepted and validFrom. For example: | id | sibling_id | version | accepted | validFrom | ... | |----|-----...
lingo
1

votes
1

answer
80

Views

Vuex and Laravel 5: how to remove Tags from Articles

I have a small blog app that has Articles and Tags. Nothing fancy so far. Every Article can have many Tags. The Laravel backend delivers the data via API calls from Axios in the Vue Frontend. In the Laravel models Article has a method public function tags(){ return $this->belongsToMany('App\Tag'...
shopfreelancer
1

votes
0

answer
424

Views

JWT-Auth responds token_not_provided when i try to validate the token

As far as i know everything is proper in back end that is Laravel, because its working well in Postman, but when i try to validate token from front-end (Angular 4) JWT-Auth throws error {'error':'token_not_provided'} This is how my request header looks like. POST /api/user HTTP/1.1 Accept:...
Suroor Ahmmad
1

votes
1

answer
60

Views

Password comparaison

I have big problem with my code. In registration, I compare my passowrd and he display password don't match. This is code {!! Form::open(array('url' => 'auth/postregister', 'class' => 'horizontal-form', 'id' => 'formRegister', 'method' => 'POST')) !!} {{ csrf_field() }} Email {!! Form::text('u_email...
Tojo RODIALSON
1

votes
0

answer
42

Views

Ajax data do not show in table?

I have Allocate_classRoom DB table where I want to show data using ajax function departmentQuery() { var department = $('#department' ).val(); if(department!=' ') { var urls = '{{ URL::to('roomAjax') }}'; var request = $.ajax({ url: urls+'/'+department, type: 'GET', dataType: 'json' });...
KaziBablu
1

votes
1

answer
598

Views

Laravel 5.5 and Angular 4 set cookie

I used laravel as backend (that implemented at homestead - mydomain.test) and angular 4 as frontend (that implemented at http://localhost:4200), now, I want to set a cookie from backend to frontend browser. Backend Controller: return response(['access_token'=>$response['access_token'], 'expires_in...
Zione01
1

votes
1

answer
41

Views

how to customize laravel user Migration to new

public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('last_name')->nullable(); $table->string('phone_number')->nullable(); $table->text('Biography')->nullable(); $table->string('address')->nullable(); $table->st...
Najib jamshidi
1

votes
2

answer
293

Views

Laravel redirect to correct path on missing routes

In my application when user enter this url as http://127.0.0.1:8000/showContent/aboutUs laravel show error as an Sorry, the page you are looking for could not be found. for that correct path is http://127.0.0.1:8000/en/showContent/aboutUs and I'm trying to manage that and adding missing segment for...
DolDurma
1

votes
0

answer
572

Views

Display form errors (laravel validator) on bootstrap collapse

I'm using Bootstrap 3.7 and Laravel 5.5. I have a form but it is into a bootstrap collapse. Moreover, I'm using Laravel Validator. How it is possible to display the form (which is hide when the page is opened) when there are errors because with the Validator the page is refresh. So I need to open t...
N. Lamblin
1

votes
1

answer
404

Views

ReactPHP - Working with Laravel and Timers

So here is a very interesting problem I am having. I am dead set on trying to figure out how to integrate a websocket client into Laravel 5.5 to allow communication over a websocket between my application and a Discord Gateway. I spooled up a new Laravel app and required this library, via composer,...
Dave
1

votes
1

answer
406

Views

Datatable how to pass data from input to controller

In datatable I have for every row one input,and I want to add some text to this input and for every input I want to take the text and save it into database Im using laravel and want to use ajax Now its working fine only for the first input but for the second whatever I wrote it will take the first i...
Hala ways
1

votes
2

answer
79

Views

How to check foreach loop for a property. Laravel

I have been trying to figure out how to filter my foreach loop and only display an image if my post has one. So far I have been trying different functions and @ifs but to no avail. Here is my controller code: @foreach($posts as $post) {{$post->title}} {{$post->body}} @endforeach
Zcylon
1

votes
1

answer
154

Views

Laravel set global variables

How i set global variable in Laravel, I tried below but its not working as expect. I created the constant files in config. constants.php return [ 'companyID' => 'Auth::user()->company', ] user.php public static function TEST() { return USER::Where('company',config('constants.companyID'))->get();...
Muhammad Kazim
1

votes
4

answer
294

Views

Laravel date input format validation

Is it possible to validate date input to name of day followed by a comma, then the day of the month, then the month and finally the year in full? eg Sunday, 31 December 2017
iMadeThisAccount
1

votes
0

answer
643

Views

How to use Vue in laravel blade?

I am going through vue 2 laracast videos I am stuck in the 1st tutorial itself. @{{ message }} var data = { message: 'Hello Vue!' } new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) don't work, gives an error Use of undefined constant message - assumed 'message' @{{ message }} gives me the r...
Abhishek Ganguly
1

votes
0

answer
163

Views

can't get Laravel Socialite to work with YouTube

I'm getting '403 Insufficient permission' for YouTube. I, however, have enabled Goolge+ API & YouTube Data API from console. It's working fine for Google+ but not for YouTube. $scopes = [ 'https://www.googleapis.com/auth/youtube.readonly' ]; return Socialite::with('youtube')->redirect(); Am I missin...
keaton
1

votes
1

answer
74

Views

Laravel Search Form NOT working

I have two search form one for the homepage and the other one is the other pages. The homepage search form searches the buildings while the other one searches the offices found in that page. The homepage search form is working here is the code BuildingController.php $search = \Request::get('search...
TeamPlar Jarj
1

votes
1

answer
72

Views

Take many elements by pluck Laravel?

public function getPackage($type) { $sale = Tour::where('id_package',$type)->get(); $pack = Package::where('id',$sale->pluck('id_package'))->get(); $loca = Location::where('id','=',$sale->pluck('id_location'))->get(); return view('page.package',compact('pack','loca','sale')); } When i use dd($sale->...
Quan Nguyen
1

votes
1

answer
658

Views

Laravel-5.5 Event-Listener not working

I want to create rows in carts table for new users When they registered. For this reason, I created UserRegistered (event) and CreateNewCart(listener) classes. I read docs and watch some youtube videos then I tried what they did. But didin't work for me.. Event; public $user; public function __cons...
1

votes
4

answer
97

Views

Mysql fetch from last to first - [many records]

i want to fetch records from mysql starting from last to first LIMIT 20. my database have over 1M records. I am aware of order by. but from my understanding when using order by its taking forever to load 20 records i have no freaking idea. but i think mysql fetch all the records before ordering. SE...
Marvin Collins
1

votes
1

answer
187

Views

Laravel check if results of GET query exists in another GETresults [closed]

I have 2 queries : $branch_workstations = \Workstation::where('branchid', $user->branchid) ->select('workstationid') ->get(); $branch_updated = \WorkstationsUpdated::where('branchid', $user->branchid) ->select('workstation') ->get(); I want to know if values of branch updated exists in branch the re...
1

votes
0

answer
127

Views

validate translatable fields with unique rule in dimsav/laravel-translatable

I'm using dimsav/laravel-translatable to make an api translatable. I have three locale fa, en and ar and there is a WarehouseType model like this : class WarehouseType extends Model { use \Dimsav\Translatable\Translatable; protected $fillable = ['name']; public $translatedAttributes = ['title'];...
A.B.Developer
1

votes
1

answer
386

Views

How to logout in laravel Multi Auth using JWT

I need help with this. i successfully set up multi auth in laravel using JWT-Auth In login functions I put this links And its work perfect. Config::set('jwt.user', 'App\Models\User'); Config::set('auth.providers.users.model', \App\Models\User::class); But in Logout function i put same line but its...
Saiful Azam
1

votes
1

answer
1k

Views

Laravel Valet sites connection refused on port 80

Ever since Chrome and Safari started forcing HTTPS redirection on the .dev TLD I've been getting issues connecting to my Laravel Valet sites. Without knowing that Chrome and Safari had done this, I updated Valet to from 1.2 and not thinking to check in Firefox first (doh! 😖). I've installed the l...
Ben
1

votes
1

answer
61

Views

Desktop admin panel for web app

I'm building a eCommerce web application for shops using Laravel/Foundation/PostgreSQL, and it will provide them (shop owners) with web based admin panel. My question is, can I make the super admin panel (the tool that I use to control everything) using desktop technology such as VB.net (or anything...
Ahmad Issa
1

votes
1

answer
64

Views

check condition within query in laravel

$q = Order::select( 'orders.*', 'items.date_start', 'items.date_end', 'items.location_name', 'items.category_id' ) ->join('items', 'items.item_id', '=', 'orders.item_id') ->leftJoin('orders_items', function ($join) use ($user_id) { $join->on('orders_items.order_id', '=', 'orders.order_id') ->on('ord...
1

votes
0

answer
116

Views

How to do Transaction begin and commit in different methods of different classes?

For e.g. A.php class A{ public function abc(){ DB::beginTransaction(); $result = Model::save(); } } B.php class B{ public function cde(){ DB::commit(); //or DB::rollback; } } These are two classes from different files. Steps : $a->abc() first will get called then payment operation then $b->cde() w...
Rahul Meshram

View additional questions