laravel

Laravel Environment Variables(without default value passed in method) not working inside Artisan Command file

流过昼夜 提交于 2021-02-04 19:32:47
问题 I am using Laravel 6.x for client's project wherein I have built an API in the Artisan Command for syncing data. Now client wants the configuration to be discreet, out of main source code and without any fallback values as possible. That means I must define the configs in the .env file and use the env() method without any fallback default values. This must be possible inside Laravel Artisan command class files, but it is not working as intended when I use the env method in the code as below:

Laravel 8 fresh installation with livewire npm install && npm run dev error

匆匆过客 提交于 2021-02-04 17:24:26
问题 When installing fresh Laravel 8.1 with livewire when in CLI i run npm run dev i got this i m new so please help me out? > mix [webpack-cli] /var/www/html/Am2/node_modules/laravel-mix/src/Mix.js:18 static _primary = null; SyntaxError: Unexpected token = at new Script (vm.js:83:7) at NativeCompileCache._moduleCompile (/var/www/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:240:18) at Module._compile (/var/www/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:184:36) at

Where to put css file in laravel project

笑着哭i 提交于 2021-02-04 17:08:49
问题 I have been searching for an answer to this question with no luck. This is my second day using laravel and I'm trying to create a custom 404 error page. I don't know where/how to include my .css file. Can someone please help me with this? 回答1: Place your css files inside public folder and use link tag in html document (or 404 template) Example <link rel="stylesheet" type="text/css" href="{{ url('/css/style.css') }}" /> 回答2: The best way is using blade syntax with the laravel helper for what

Laravel Reset Password Using Different Column Name

主宰稳场 提交于 2021-02-04 16:09:31
问题 i managed to make it work when it comes to authorisation with different columns name either username, email or password. How to change / Custom password field name for Laravel 4 and Laravel 5 user authentication however the password reminder seems doesnt work. i have changed the user model, to my table column name. User Model: use Illuminate\Auth\UserTrait; use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableTrait; use Illuminate\Auth\Reminders\RemindableInterface;

Using Laravel Passport with mobile application

情到浓时终转凉″ 提交于 2021-02-04 14:18:06
问题 I am making a mobile application with a laravel API, and I saw that since Laravel 5.3(?) they added something called "Passport" which handles OAuth2/verification for an application, so I thought I would give that a try. I followed several different explanations for how to get it working after I completed the setup using the Laravel Passport documentation (https://laravel.com/docs/5.4/passport). Right now this is the code for what I've come up with based off other tutorials/ SO articles 1.)

Eager load relationships in laravel with conditions on the relation

点点圈 提交于 2021-02-04 13:31:09
问题 I have categories related to each other in a tree. Each category hasMany children. Each end category hasMany products. The products also belongsToMany different types. I want to eager load the categories with their children and with the products but I also want to put a condition that the products are of a certain type. This is how my categories Model looks like public function children() { return $this->hasMany('Category', 'parent_id', 'id'); } public function products() { return $this-

Query relationship Eloquent

左心房为你撑大大i 提交于 2021-02-04 10:37:30
问题 I have News model, and News has many comments, so I did this in News model: public function comments(){ $this->hasMany('Comment', 'news_id'); } But I also have field trashed in comments table, and I only want to select comments that are not trashed. So trashed <> 1 . So I wonder is there a way to do something like this: $news = News::find(123); $news->comments->where('trashed', '<>', 1); //some sort of pseudo-code Is there a way to use above method or should I just write something like this:

routes content does not show in Vue-router and Laravel

依然范特西╮ 提交于 2021-02-04 07:39:17
问题 Im following this YT tutorial, I followed the steps but it seems that the ExampleComponent does not show. The App.vue shows but not the route. Here are my code: app.js import Vue from 'vue'; import router from './router'; import App from './components/App'; require('./bootstrap'); const app = new Vue({ el: '#app', components: { App }, router, }); router.js import Vue from 'vue'; import VueRouter from 'vue-router'; import ExampleComponent from './components/ExampleComponent'; Vue.use(VueRouter

routes content does not show in Vue-router and Laravel

久未见 提交于 2021-02-04 07:39:05
问题 Im following this YT tutorial, I followed the steps but it seems that the ExampleComponent does not show. The App.vue shows but not the route. Here are my code: app.js import Vue from 'vue'; import router from './router'; import App from './components/App'; require('./bootstrap'); const app = new Vue({ el: '#app', components: { App }, router, }); router.js import Vue from 'vue'; import VueRouter from 'vue-router'; import ExampleComponent from './components/ExampleComponent'; Vue.use(VueRouter

Laravel Timestamp Being Updated Without Explicit Call To Do So

最后都变了- 提交于 2021-02-04 07:32:43
问题 So I'm running into an annoying problem with Laravel update and save. I have a model/table Invoice and invoices , that has a timestamp sent_at . Invoice.php class Invoice extends Model { protected $dates = [ "sent_at", ]; } I have the following function that updates the Invoice : InvoicesController.php : public function postPayInvoice(Request $request, $invoiceId){ $user = $this->apiResponse->user; $invoiceItemIds = $request->input("invoice_item_ids"); $invoice = Invoice::with(["invoiceItems"