laravel

Gcloud app deploy SQLSTATE[HY000] [2002] No such file or directory

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 10:14:07
问题 I already have a working laravel project with database in my local host. But when i use GCP app engine i follow the step with database connection. I already create mysql database in my cloud and imported all my sql from working local database. When i app deploy the shows SQLSTATE[HY000] [2002] No such file or directory below are my app.yaml file content runtime: php env: flex runtime_config: document_root: public # Ensure we skip ".env", which is only for local development skip_files: - .env

How to assign two middleware to the same group of routes. Laravel

孤者浪人 提交于 2021-01-29 10:13:45
问题 I have 3 Middleware with all different routes assigned. These are the routes that correspond to each user type. Like this: In my routes I have this Route::group(['middleware' => 'auth'], function () { Route::resource('/', 'DashController'); Route::get('/logout')->name('logout')->uses('Auth\LoginController@logout'); Route::group(['middleware' => ['director']], function () { //survey //questions //groups //forum }); Route::group(['middleware' => ['super']], function () { //import }); Route:

How to send information from the vue.js file to the controller like an id? Laravel - Inertia-vue

冷暖自知 提交于 2021-01-29 09:59:54
问题 I'm trying to open a page from a button, but I need to send the id of the item where the button is in. For context this is a discussion forum page, in the users dash they are shown the forums they can comment on and there is a button on the bottom of each, what I need to send is that forums id, so that when they click on the button it takes them to the correct forum view. How can I do this? I'm trying different ways <el-button type="primary" @click="submit(f.id)"> Answer </el-button> submit(

Display selected image from input file

假如想象 提交于 2021-01-29 09:43:08
问题 my question is how to display the selected file image from the input file in img tag, I have described the code below. <img src="" width="200" height="100"> <input type="file" name="logo" id="upload-logo" /> $('#upload-logo').on('change', function(){ let logo = $(this).val(); $('img').attr('src', logo); }); but the result I got after changing the src attribute is: Not allowed to load local resource: file: /// C: /fakepath/Capture.PNG, and photos are not displayed I do not want to use ajax 回答1

In Laravel, do I have to create a separate model and controller for each database table/collection?

为君一笑 提交于 2021-01-29 09:40:32
问题 I am developing a little application with PHP web framework Laravel v6 and MongoDB (with jenssegers moloquent) as database engine. This is my first encounter with any MVC framework. I have the following collections in my database: allPaintingsCollection paintingHistoriesCollection paintingCategoriesCollection artGalleriesCollection paintingArtistsCollection supervisorArtistsCollection smPlatformsCollection nonSmPlatformsCollection targetSchoolsCollection I have been following this tutorial. I

Does Laravel Dompdf support subsetting otc fonts?

纵然是瞬间 提交于 2021-01-29 09:39:23
问题 I've been using vsmoraes dompdf for generating pdf and I use Arial unicode MS (.ttf) which work perfectly with font subsetting enabled. Since it's not free, I tried to move to Noto Sans. But I get a error when I enable font subsetting. .ttf works fine. But not .otc #message: "Undefined index: glyf" vsmoraes version - 1.0. Is there any laravel library that I can use which support font subsettings with .otc font type ? or is there any suggestions 来源: https://stackoverflow.com/questions/54461754

Laravel: OrderBy nested object in collection

血红的双手。 提交于 2021-01-29 09:36:19
问题 My LaravelController returns me an Collection with a nested object. What I need to do is to order it by a property of the nested object. The collection looks like this: {ID:1, subobject:{order:555} }, {ID:2, subobject:{order:444} }, I want to order the objects by subobject.order (ascending) (ordered->subobject->order) This is what the Controller currently does: $ordered = List::with('stuff')->whereIn('ID', $foo) ->with('extrastuff') ->get(); The result of this is fine, just not in the order I

Laravel hasone relationship

与世无争的帅哥 提交于 2021-01-29 09:16:20
问题 I am trying to use hasone relation but getting null error. below is my code User Model: function profile() { $this->hasOne('App\Profile'); } Profile Model: function User() { return $this->belongsTo('App\User'); } Register Controller protected function create(array $data) { $user = User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); if($user) { $profile = new Profile(); $profile->name = 'Fake Name'; $profile->father = 'Fake Father

Laravel hasone relationship

久未见 提交于 2021-01-29 09:09:36
问题 I am trying to use hasone relation but getting null error. below is my code User Model: function profile() { $this->hasOne('App\Profile'); } Profile Model: function User() { return $this->belongsTo('App\User'); } Register Controller protected function create(array $data) { $user = User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); if($user) { $profile = new Profile(); $profile->name = 'Fake Name'; $profile->father = 'Fake Father

Subtract 2 Columns from different tables

泪湿孤枕 提交于 2021-01-29 08:47:57
问题 I'm trying to build a query where 2 columns from different tables get subtracted. This is what I tried: DB::connection('lab_inv')->where('tab2'.'Amount_Run', '=', 'tab1'.'Amount')->selectraw('tab1.Amount - tab2.Amount_Run'); The first table has the value ‘Amount’ which is unique for each id, the second table is bound by a foreign key to the id of the first table and has the parameter ‘Amount_Run’ which is also different depending on the id. Amount = Amount – Amount_run. Any Idea what I’m