laravel-5

Generate Model, Controller outside of app folder in Laravel

喜夏-厌秋 提交于 2021-02-17 02:34:33
问题 How to create controller and model files outside of app folder. For example, when we do php artisan make:model ModelName it creates Model file inside app folder. When we specify namespace like php artisan make:model SomeFolder/ModelName it creates Model file inside app/SomeFolder/ModelName. I wanted to create model files outside of app folder. How to achieve this? 回答1: I don't see the reason, but I managed to make it on my local computer by php artisan make:model ../../mOdel . Probably in

Generate Model, Controller outside of app folder in Laravel

二次信任 提交于 2021-02-17 02:32:30
问题 How to create controller and model files outside of app folder. For example, when we do php artisan make:model ModelName it creates Model file inside app folder. When we specify namespace like php artisan make:model SomeFolder/ModelName it creates Model file inside app/SomeFolder/ModelName. I wanted to create model files outside of app folder. How to achieve this? 回答1: I don't see the reason, but I managed to make it on my local computer by php artisan make:model ../../mOdel . Probably in

Invalidate login in Laravel when user leaves the page

蹲街弑〆低调 提交于 2021-02-16 17:57:50
问题 It seems a small and easy to solve problem, but I cant find any solution for it. I want to login the users only for that session while the are browsing the site. As soon as they close the tab I want to make their session expired. As much as I know I can't do this in the built-in Auth class. How could I do this efficiently? 回答1: Short answer: YOU CAN'T The session can be destroyed when the entire browser is closed by simply setting expire_on_close in config/session.php (also make sure you

How to use order by query both with current table column and relationship table column in laravel?

笑着哭i 提交于 2021-02-11 14:45:24
问题 i am trying to fetch record with order by query but situation is this that i have to use order by both on current table column and relationship table column in laravel . I tried this $consignments = Consignment::where('delivery_run_id', $id)->whereIn('status', [ 'In Warehouse', 'With On Forwarder', 'In Transit (Warehouse->Delivery)', 'Awaiting Pickup' ])->with(['consignment_run_sheet' => function ($query) { $query->orderBy('run_sheet_id'); }])->orderBy('delivery_date', 'DESC')->get();

Laravel 5.6 “Unresolvable dependency resolving…” when doing dependency injection

被刻印的时光 ゝ 提交于 2021-02-11 14:34:03
问题 I am trying to bind a class into the container via a middleware and it doesn't seem to work because the class that I am binding recieved 2 parameters in the constructor and they aren't recognised. I am getting the following error message: " Unresolvable dependency resolving [Parameter #0 [ $base_url ]] in class App\Services\Factureaza ". Here is the middleware: <?php namespace App\Http\Middleware; use App\Services\Factureaza; use Closure; class InitializeInvoiceProvider { public function

Why is my $items doesn't hold a group of $item? Laravel 8 Ecommerce

安稳与你 提交于 2021-02-11 14:19:37
问题 I'm from the same post here but I've found the root problem why is my quantity won't increment but I don't know how to solve this. The problem is at my isset function (in Cart.php), because I tried to echo something there and just realized the function isn't running. This is the error pops up when I removed isset function at the if($this->items). I tried to dd($items) too, and it said null. Why is my $items isn't holding a group of $item? Do you guys know why and how to solve this? p/s: from

count values through id in laravel

╄→尐↘猪︶ㄣ 提交于 2021-02-11 12:11:26
问题 hello i am trying to count values from array. my ResidentMail table look like id resident_id mail_type 1 10 message 2 10 wellness 3 10 message 4 11 wellness 5 11 wellness 6 11 message this is my array look like array( [0] => [ [0] => [ 'id' => 1 'resident_id' => 10 'mail_type' => 'message' ], [1] => [ 'id' => 2 'resident_id' => int 10 'mail_type' => 'wellness' ], [2] => [ 'id' => 3 'resident_id' => int 10 'mail_type' => 'message' ] ], [1] => [ [0] => [ 'id' => 4 'resident_id' => 11 'mail_type

count values through id in laravel

浪子不回头ぞ 提交于 2021-02-11 12:10:20
问题 hello i am trying to count values from array. my ResidentMail table look like id resident_id mail_type 1 10 message 2 10 wellness 3 10 message 4 11 wellness 5 11 wellness 6 11 message this is my array look like array( [0] => [ [0] => [ 'id' => 1 'resident_id' => 10 'mail_type' => 'message' ], [1] => [ 'id' => 2 'resident_id' => int 10 'mail_type' => 'wellness' ], [2] => [ 'id' => 3 'resident_id' => int 10 'mail_type' => 'message' ] ], [1] => [ [0] => [ 'id' => 4 'resident_id' => 11 'mail_type

Invalidating Session not logging out - Laravel 5

旧巷老猫 提交于 2021-02-11 12:06:10
问题 So basically a user can stay logged in accross iPhone, Chrome, Firefox and multiple browsers and I want to stop that, and only allow the user to be logged in at (1 session only at a time). Meaning: When the user logs in somehwere else... it logs them out on the other. I have added the following to the very bottom of my LoginController.php /** * The user has been authenticated. * * * @return mixed */ protected function authenticated() { \Auth::logoutOtherDevices(request($password)); } I also

Invalidating Session not logging out - Laravel 5

房东的猫 提交于 2021-02-11 12:03:11
问题 So basically a user can stay logged in accross iPhone, Chrome, Firefox and multiple browsers and I want to stop that, and only allow the user to be logged in at (1 session only at a time). Meaning: When the user logs in somehwere else... it logs them out on the other. I have added the following to the very bottom of my LoginController.php /** * The user has been authenticated. * * * @return mixed */ protected function authenticated() { \Auth::logoutOtherDevices(request($password)); } I also