Category : php

When I’m trying to use the string helper Str::plural with Laravel, if the number of results is 0, the output string is pluralized. https://laravel.com/docs/8.x/helpers#method-str-plural Laravel version 8.17.0 echo Str::plural(‘article’, 1); //output article echo Str::plural(‘article’, 2); //output articles echo Str::plural(‘article’, 0); //output articles Why this helper have this behavior instead outputs a singular string like with ..

Read more

Why Laravel helper string Str::plural doesn’t work properly with 0 and add the "s" letter ? https://laravel.com/docs/8.x/helpers#method-str-plural Laravel version 8.17.0 echo Str::plural(‘article’, 1); //output article echo Str::plural(‘article’, 2); //output articles echo Str::plural(‘article’, 0); //output articles Thanks for help Sourc..

Read more

This is the front view of my home page. home page When i upload a.csv type file it will store in a migration table call "project" with 4 columns(id,name,created date,updated date).I want to fill the table in home page by addressing {$project->id}.Is there any possibility to do this without using maatwebsite package. http/controllers/UploadFileController.php <?php namespace ..

Read more

I’m working with Laravel 8 to develop my project and I have made two routes for my form: Route::get(‘profile/twoFactor’, [AppHttpControllersProfileController::class, ‘manageTwoFactor’])->name(‘profile.2fa.manage’); Route::post(‘profile/twofactor’, [AppHttpControllersProfileController::class, ‘postManageTwoFactor’]); And here is my form: <form method="POST" action=""> @csrf <div class="field select"> <select name="type"> <option value="off">OFF</option> <option value="sms">SMS</option> </select> </div></br> <div class="field"> <input type="phone" name="phone" placeholder="Phone number"> </div></br> <button class="BJadidBold">Send Code</button> ..

Read more

I’m trying to make an e-commerce admin/user authentication I use laravel 8 went register a test account and logged in and this error occured. Error Class ‘LaravelFortifyActionsAuth’ not found After i logged in a test account it was supposed to result like this https://ibb.co/Vq5LxBk C:UsersACERlaravel8ecommercevendorlaravelfortifysrcActionsAttemptToAuthenticate.php:58 This was the line 58 if(Auth::user()->utype === ‘ADM’) My code ..

Read more

In my application I have two columns employable_id && employable_type in almost every table, which are used for storing the information about the user who has created the record. Something like this: subscribers: products: ———————————— ———————————— id | employable_id | employable_type id | employable_id | employable_type ———————————— ———————————— 1 | 1 | AppCompany 1 | ..

Read more

I want to send email verification link to users after registration using phpmailer(laravel). everything was working fine a couple of days ago but it has stop working now. i really cant tell what is wrong. it always give me the email error(‘Sorry something went wrong we could not send you an email verification link’) mail_handler.php ..

Read more

When I enter long URL, I get blank white page without any source code. At example: http://www.laravel-page.com/dashboard/account/edit works. But http://www.laravel-page.com/dashboard/account/edit/success does not works. Of course I do not have to add /success at end of URL. That is only example. I would like to know why it does not work. My project works on Apache. ..

Read more

I want to get a list of all timezones. When I use DateTimeZone::listIdentifiers() I get a list, And when I use DateTimeZone::listAbbreviations() I get a list with different entries. Each list has values that are not in the second list. How to get a complete list? Why is there a difference between the two functions? ..

Read more

Creating a laravel package, which has its own dependencies as well. The package depends on another package: e.g. lets say I have the two packages .e.g: package: Contractors: Above package holds the Contractors details and all that info about the Contractors pacakge: Accounting: This package process the Contractors payments and all other payments of fed ..

Read more

I was passing data on a variable using my controller: public function editpage($cart_id){ $carts = DB::table(‘carts’) ->join(‘shoes’, ‘carts.shoe_id’,’=’,’shoes.id’) ->select(‘shoes.shoe_name’,’shoes.shoe_image’,’carts.quantity’,’shoes.shoe_price’) ->where(‘carts.id’,$cart_id) ->get(); return view(‘editcart’,compact(‘carts’)); } And here is my blade: @extends(‘layouts.app’) @section(‘content’) <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">EditCart</div> <img src="{{ asset("$carts->shoe_image") }}" alt="" style="width:200px; height:200px;"> {{$carts->shoe_name}} {{$carts->quantity}} ${{$carts->shoe_price * $carts->quantity}} {{dd($carts)}} ..

Read more

I am currently trying to create E-commerce project and layout setup by following this video. https://www.youtube.com/watch?v=MfE1tnMG6fE&t=2s Unfortunately this error happened. C:UsersACERlaravel8ecommerce>php artisan serve UnexpectedValueException Invalid route action: [HomeComponent]. at C:UsersACERlaravel8ecommercevendorlaravelframeworksrcIlluminateRoutingRouteAction.php:92 88▕ */ 89▕ protected static function makeInvokable($action) 90▕ { 91▕ if (! method_exists($action, ‘__invoke’)) { ➜ 92▕ throw new UnexpectedValueException("Invalid route action: [{$action}]."); 93▕ } ..

Read more

I have tried to trim "appointment" to check if it is equal to string that I have sent by trim function from ajax. But trim(‘appointment’) doesn’t give me what I need. How can delete whitespaces from object in sql to check some condition using where public function category_filter(Request $request) { $appointment = json_decode($request->appointment); $categories = ..

Read more

I am trying to display the error div below a certain field if the validation for that input failed along with the previous input on the designated field. Here’s my progress so far: in my controller file inside the store function (UserController > store): public function store(Request $request) { $validationRules = array( ‘first_name’ => ‘required|min:2|max:150’, ..

Read more

My files are saved in resourcesviewslayouts as in the picture below : The code I am using is simple discribed below : header.blade.php <h1>Header</h1> footer.blade.php <h1>Footer</h1> index.blade.php @include(‘layouts.header’) @yield(‘center’) @include(‘layout.footer’) allproducts.blade.php @extends(‘layout.index’) @section(‘center’) <h1>This is the center of the page</h1> @endsection I always have this error: View [layout.index] not found. I included the photo to ..

Read more

Here is my situation. I have this test UpdateAdditionalCommandHandlerTest which is a test for UpdateAdditionalCommandHandler And here is the code: class UpdateAdditionalCommandHandler implements CommandHandler { use DispatchableTrait; use ValidationCommandBus; /** * @var AdditionalRepository */ protected $repository; /** * @param AdditionalRepository $repository */ public function __construct(AdditionalRepository $repository) { $this->repository = $repository; } /** * @param UpdateAdditionalCommand ..

Read more