#### Category : php

I’m trying login the correct way using Laravel Passport by following the docs regarding how to do this but I’m just a little stuck on something. For now, for my user – I’m copy & pasting the client_id and client_secret values. I’m grabbing the client_id from the oauth_access_tokens table via the client_id column. and I’m ..

I’m very new to Redis and fairly new to Laravel so could use some pointers on this. We have a legacy PHP application that stores sessions to Redis and I’m able to see it in Redis with the default naming convention, ie.: PHPREDIS_SESSION:1bd9ca87f5b606a35891c807857c2fde We’re moving towards a Laravel API framework and as a short-term hybrid ..

how to make the encryption shorter in characters? Crypt::encrypt($event->id)) Result: http://myurl/id/eyJpdiI6Im5ub0hyaWJwVE1iendYbHNaSzJsSXc9PSIsInZhbHVlIjoiVHhpNmF4b3NlQjk2NFluRXhCOFZuQT09IiwibWFjIjoiZDkxNzk2OTlmZGRmZWJjYjFlNjExYjcyNWU4Y2Y4NWYwMjYxMTkxN2ZmNzU3NGM4Nzg0OWJkNjk1NmExNjVkZiIsInRhZyI6IiJ9 generates a very large link, I need to shorten it, is it possible? Sourc.. Read more How can I make so it searches for either projects.title or items.title and still returns the result if it only matches one of them? Right now if it matches an item, it will not show up unless it matches a project title as well and the other way around. I understand why, but I probably .. Read more$validator = Validator::make($request->all(), [ ’email’ => ‘required|min:9|max:50|email’, ‘password’ => ‘required|min:8|max:255|password’ ]); if ($validator->fails()) { echo "Failed! Sorry :("; Session::flash(‘error’, $validator->messages()->first()); //return Redirect::back()->withErrors($validator); } else {… But if I write ‘password’ => ‘required|min:8|max:255’ the validation is passed, but when I write ‘password’ => ‘required|min:8|max:255|password’ it doesn’t pass and the result is "Failed! Sorry :(". I mean ..

I have two models, Menu and User with many to many relationship. So, at this moment I have lot of records with the same user_id and menu_id in the pivot table, and the user must to can detach only one of them and not all of them. So, I made a AJAX request to "remove" ..

I installed Laravel Passport and migrated the new tables just fine in my database. But when I try to run migrations for the testing database, ie. artisan migrate –database=testing I get: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘oauth_auth_codes’ already exists The only table that exists in the testing database is the migrations ..

I have zero php experience, but need to fire up an existing application that I have cloned (which is supposed to be functional), to test it quickly. I think I’m pretty close to have it working. If I run php artisan serve: [[email protected] appliweb]$php artisan serve Starting Laravel development server: http://127.0.0.1:8000 [Tue Sep 28 .. Read more Im using a jquery repeater to repeat input fields and i need to find the name of the last input field added (with the a specific id). How im doing it :$(‘#addElements’).on(‘click’, function() { var nameOfLastInput = $("#inputID:last").attr("name"); console.log(nameOfLastInput); }); What i get is the name of the first field every time: Full working .. Read more In my laravel based application, when updating user accounts I’m trying to validate the birthday field. I have the following in my controller’s update method ‘date_of_birth’=>[‘required’,’date’, ‘date_format:Y-m-d’, function ($attribute, $value,$fail) { $age=Carbon::createFromFormat(‘Y-m-d’,$value)->diff(Carbon::now())->y; if($age<18||$age>70){ $fail(‘Âge invalide. l’âge devrait être 18-70’); } },] So the date format has to be Y-m-d and the age range .. Read more Anyone can help to put this into a Laravel Eloquent statement ? where timestamp = unix timestamp SELECT max(timestamp) ,value FROM forex group by FROM_UNIXTIME(timestamp,’%Y%m%d’ ) Sourc.. Read more I have a very strange bug affecting a small portion of my userbase in my Laravel framework based PHP website. I am using Microsoft’s OAuth 2.0 authorization to log in users. Basically the normal OAuth2 authorization flow: User navigates to /login Generate random state variable and save it to session Build OAuth2 /authorize endpoint auth .. Read more Inside a controller in Laravel I have this: public function index() {$users = User::orderBy(‘name’, ‘asc’)->paginate(13); $users2 = User::all(); return view(‘contatos.index’)->with(‘users’,$users); return view(‘auth.register’)->with(‘users’, $users2); } I know isn’t right, it’s just to demonstrate my logic. Is there a way to unite these two returns in a single return? Or even a much shorter form .. Read more I’ve created a simple laravel queue, a controller with a method which dispatches jobs into the queue, and a job for handling logic. My plan is to have multiple queue workers using Supervisor config. And it works fine. Supervisor config: /etc/supervisor/conf.d/worker-node.conf [program:laravel-worker] … autostart=true autorestart=true stopasgroup=true killasgroup=true user=admin numprocs=8 //8 concurrent workers … Problem is .. Read more When I’m logged as Admin( I’m setting a column which has utype="ADM" to verify me as admin in a session).And when I try to access the admin dashboard page I get redirected to login page and so on without accessing the dashboard eventually. This is my AuthAdmin.php <?php namespace AppHttpMiddleware; use Closure; use IlluminateHttpRequest; class .. Read more I want to quiz some candidates before hiring. I want them to generate a username, password and link and solve the questions I have set. They have to be completed in a certain time. how can i do this using laravel? I don’t want them to register on my site. because it is not safe. .. Read more I am using SQL server as database to connect from our Laravel project, and need the following connection properties to be set before all eloquent queries and raw Laravel queries: SET NOCOUNT ON; SET ANSI_NULLS ON; SET ANSI_PADDING ON; SET ANSI_WARNINGS ON; SET ARITHABORT ON; SET CONCAT_NULL_YIELDS_NULL ON; SET NUMERIC_ROUNDABORT OFF; SET QUOTED_IDENTIFIER ON; What .. Read more In my laravel based application, when creating new user accounts I’m trying to validate the birthday field. I have the following in my controller’s store method ‘date_of_birth’=>[‘required’,’date_format:m/d/Y’,function ($attribute, $value,$fail) { $age=Carbon::parse($value)->diff(Carbon::now())->y; if($age<18||$age>70){ $fail(‘Âge invalide. l’âge devrait être 18-70’); } },] So the date format has to be m/d/Y and the age range has to .. Read more I am using withCount() to count the number of articles in a category, everything works well. The question is how to count and display the number of articles for All categories? Controller$categories = BlogCategory::withCount(‘articles’)->get(); blade.php <div class="blog-filter"> <div class="blog-filter__item active" data-filter="all">All</div> @foreach($categories as$category) <div class="blog-filter__item" data-filter=".category_{{$category->id}}" value="{{$category->title }} ({{ $category->articles_count }})">{{$category->title ..

i am a newbie and new to laravel but there is the project im working on i am working on a bitcoin/ Eth mining platform and when users click on withdraw amount, it tells them that ‘withdrawal value must not be greater than 1" here is the code in methods.blade.php <!– Modal –> <div class="modal ..

I have comment List API with Pagination in laravel and I want a comment replay Array with every comment but only the last 3 comment replay. public function CommentReplay(){ return $this->hasMany(‘AppPostCommentReplies’,’comment_id’,’id’)->orderBy(‘id’,’DESC’); } And Query I have use PostComments::select(‘post_comments.*’)->with([‘users’,’CommentReplay’=> function ($query) { $query->select(‘post_comment_replies.*’) ->orderBy(‘id’,’DESC’)->take(3); }])->orderBy(‘id’,’DESC’)->paginate(10); In this, I have been getting only the last 3 comments .. Read more I have this in view. It is able to upload alright but it won’t show. Is there anything more I should add? <div class="col-md-4"> <img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/> </div> here is my show.blade.php file <div class="col-md-4"> <img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/></div> Here is the player.blade.php file: @if(count($players) > 0) <?php \$index = 0; ?> ..