In my Laravel9 project, I have many controllers that have similar functions like: TestController.php Test1Controller.php So I modified them into: TestController.php Test1Controller.php ApiController.php TestInterface.php BaseInterface.php Then I bind interfaces into services in AppServiceProvider.php, like: TestService.php: Test1Service.php When I call TestController::index on my route, I get: Cannot call abstract method AppContractsTestInterface::index() How can I fix it or do any better suggestions?
Tag: laravel
I want to add 94 at the beginning of the very number i insert
I want to add 94 at the beginning of the very number I insert from this input area. This is POS system which is written under laravel framwork. screenshot of the area Answer You should change second parameter ‘null’ to ’94’ of Form::text, it’s a default value. You can learn more from laravel’s documentation : https://laravel.com/docs/4.2/html
Laravel 9 and Livewire Validation for Unique Unless Updating
The below validation works when creating a new record, but when updating a record, partner_code and seedgens_code are getting caught in the unique validation. How do I allow a record to be updated with the same values if not changed, but still validate for unique when the value does change? Answer or where $id is the ID that you want
Laravel Query with Implode
i have an array with values So i want search these three items from tables using like query I tried where(‘primary_skill ‘, ‘like’, ‘%’ . implode(“‘ OR primary_skill LIKE ‘%”, $skill_name) .’%’) which is not working for me.Any help would be highly appreciated. Answer ->where(‘primary_skill ‘, ‘like’, ‘%’ . implode(“‘ OR primary_skill LIKE ‘%”, $skill_name) .’%’) Above line is incorrect
Laravel Action Route not Define
I have unique problem. I already create Route on web.php, on Controller, and Blade. and working on my localhost. but after publish to real server, I jus got error Action urlcontroller@function not define. this is my code. this is my web.php this is my controller and this is code on blade to call controller@function this step same as another controller,
How to make my post featured in Laravel 9
I have made a create post function and I would like to make a certain section only have a featured post. I’m new to laravel and php so was not to sure how to do it. I created a featured column in my db and passed a foreach($posts as $featured) into the section I wanted featured. From my research, the
How to use Laravel’s service provider for external API usage which utilizes user based credentials
So I’m working on a Laravel admin application, which consumes an external API, let’s call it PlatformAPI. The way Platform works, is that the users of my application have an account on Platform. My Laravel application will function as a admin dashboard, so the users can view some basic reports, which are fetched from PlatformAPI. Every user in my application
How to have string query and date query at the same time in Laravel with Eloquent
At first my code works fine with just one parameter when querying, but when I add more parameters, it start to throw errors. Here is MyEditController file: Here is my web.php : Here is my Blade: Here is My Controller: When I adding Some Parameter using this code it start showing error: When I filter it with date it work
Add “where” and “whereIn” clause only when filter value is not null
I am looking for optimum way to add where clause in Laravel query when there are multiple filters(5+ filters) only if filter values are not null. Right now I am having 6 filters on report on front end which will send input to api. below is a pseudocode which i want to achive. I know the simple solution using combination
How can I apply atomic locks to all of my routes in Laravel?
I have a single page application which is computing multiple AJAX requests, via axios. Occasionally, I run into a scenario where both requests run async at the same time and attempt to write to the session which causes a 419 response code where the CSRF token is dropped in the response forcing me to have to logout the user. After