skip to Main Content

how to get data from 19:00:00 pm to 07:00:00 am – Laravel

$star = $request->input('start_date'). ' ' . '19:00:00'; $end = $request->input('end_date'). ' ' . '07:00:00'; $employee_qty_in_shift2 = PatrolGateSurveillanceTransaction::where('type', 1) ->where('client_location_id', $request->client_location_id) ->where('created_at', '>=', $star) ->where('created_at', '<=', $end) ->sum('employee_qty'); dd($employee_qty_in_shift2); The above code cannot filter data from 19:00:00 to 07:00:00 Expected result:…

VIEW QUESTION

Laravel eloquent find in array of objects column

I have a table called services with multiple columns and one column named staff_assigned with this content: [{"user_id":"15549","price":"100"},{"user_id":"15548","price":"300"},{"user_id":"15552","price":"95"},{"user_id":"15553","price":"600"}] How can I find all services where user_id is 15548 with Laravel eloquent? Note that Service::where('staff_assign->user_id', "15548")->get(); doesn't work because column contains…

VIEW QUESTION

Making a custom laravel directive to detect if view is served on mobile or desktop

I have created this directive in my AppServiceProvider and this is the code <?php namespace AppProviders; use IlluminateSupportServiceProvider; use IlluminatePaginationPaginator; use IlluminateSupportFacadesAuth; use IlluminateSupportFacadesView; use IlluminateSupportFacadesDB; use Blade; class AppServiceProvider extends ServiceProvider { /** * Register any application services. *…

VIEW QUESTION

cant install laravel in composer

Tried creating a new project on a corporate proxy and suddenly composer cant create a laravel project. "curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10001 millisec onds" been trying different stackoverflow solutions but none of them solves…

VIEW QUESTION

Display laravel blade in repository pattern

In my Laravel application, I have the following index function in the PostController.php class PostController extends Controller { private PostRepositoryInterface $postRepository; public function __construct(PostRepositoryInterface $postRepository) { $this->postRepository = $postRepository; } /** * Display a listing of the resource. * *…

VIEW QUESTION
Back To Top
Search