laravel-5.8

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message Laravel 5.8 and Ajax

你说的曾经没有我的故事 提交于 2020-02-07 05:46:24
问题 I'm trying to store multiple emails in a prospect system. I'm building the system with Laravel 5.8. I'm trying to put the emails using the AJAX request. And not return in a page using redirect, but keep in the same modal. This is for a system that in the past, can only store one email. But a user says that need to store more than one email to the client. Now i'm trying to create a functionality that in a prospect, you can add multiple emails and when the user will send a proposal, will show

getDirty() Soft Deleted Item in deleted() Observer Method, Laravel 5.8

◇◆丶佛笑我妖孽 提交于 2020-01-25 04:01:08
问题 I want to delete an image every time I delete an item so I tried using an observer and put my code in deleted method, but I can't get deleted data although I'm using soft delete. I already try this in my observer, but it fail. public function deleted(Board $board) { $thisBoard = Board::withTrashed()->getDirty(); $imageName = $thisBoard['image']; Storage::delete("public/" . $board->getImageFolder() . $imageName); Storage::delete("public/" . $board->getImageFolder() . "thumbnail/{$imageName}");

Class App\Http\Controllers\PostConstroller does not exist

谁说我不能喝 提交于 2020-01-07 09:23:58
问题 Hello I try to create post with Laravel, but I have this error : Class App\Http\Controllers\PostConstroller does not exist Route: Route::get('/', function () { return view('welcome'); }); Auth::routes(['verify' => true]); Route::get('/home', 'HomeController@index')->name('home'); Route::get('/profile/{user}', 'ProfileController@show')->name('profile.show'); Route::get('/posts/create', 'PostConstroller@create')->name('posts.create'); Route::post('/posts', 'PostConstroller@store')->name('posts

Handling multiple image upload with React JS & Laravel

一个人想着一个人 提交于 2019-12-24 15:45:13
问题 I want to upload multiple images to the database by using axios in reactjs to send the data from client-side to server-side and handle the image upload with laravel in the server-side. My problem is that whenever i try to handle multiple images at the server-side, it doesn't work. This is my code. CLIENT-SIDE (ReactJS) CONSTRUCTOR: constructor(props){ super(props); this.state = { id: "upload-photo", imageArray: [], body: '', posts: [], // image: [] }; this.handleSubmit = this.handleSubmit

Laravel: Additional Login Conditions not working

人走茶凉 提交于 2019-12-13 18:16:27
问题 I'm doing a Laravel authentication. I don't know if it is important to clarify that I'm using the Auth::routes . I added an active field to my users model. But even when is not active, I'm able to log in. This is my user model: <?php namespace App\Models; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Laravel\Passport\HasApiTokens; use Laratrust\Traits\LaratrustUserTrait; use Illuminate\Foundation\Auth\User as Authenticatable; use Auth; class User

Laravel Feature Testing. Cache mocking not working! CacheManager::driver(), but no expectations were specified

拜拜、爱过 提交于 2019-12-13 04:08:30
问题 When I test my application with unit-testing cache moking works well. But when I try test my api through feature tests I got an exception. public function testGet() { Cache::shouldReceive('rememberForever')->times(5)->andReturn([]); Cache::shouldReceive('has') ->once() ->andReturn(false); Cache::shouldReceive('forever') ->once() ->andReturn([]); $response = $this->getJson('/api/table/get'); $response->assertOk(); $responseArr = $response->getOriginalContent(); $this->assertEmpty($responseArr[

Laravel 5.8 update mysql json column cast as array changes data stored format

你离开我真会死。 提交于 2019-12-13 03:58:28
问题 I have a table with a json column cast as array. The Schema creation has the column defined like this: $table->json('row_ids'); In my class: protected $casts = [ 'row_ids' => 'array', ]; I generate the data in this array / column by getting every row id from another table like this: $id_array = DB::table($table->name)->pluck('api_id')->toArray(); TableChannelRow::create([ 'table_api_id' => $table->api_id, 'channel_api_id' => $channel->api_id, 'row_ids' => $id_array, ]); When I dd a collection

Add an all views wilcard to view composers from within a laravel package

强颜欢笑 提交于 2019-12-13 03:24:04
问题 I have a view composer working from within a package for a specific directory: $view->composer( 'cms::admin.*', ProfileComposer::class ); But I also have view composers that should be loaded across all root views, however the following are not being loaded as required: $view->composer( 'cms::*', NavigationComposer::class ); $view->composer( 'cms::*', SiteConfigComposer::class ); Any idea how to apply these view composers to all routes? 回答1: If it's across all route views, why restrict it to

failed to load component in laravel 5.8

a 夏天 提交于 2019-12-13 03:16:23
问题 I have below 2 components in vue.js and using in Laravel 5.8 Here is app.js file. require('./bootstrap'); import VeeValidate from 'vee-validate'; window.Vue = require('vue'); Vue.use(VeeValidate); Vue.component('profile', require('./components/Account/Profile.vue').default); Vue.component('change-password', require('./components/Account/changepassword.vue')); const app = new Vue({ el: '#app' }); Below is the code in change password component. <template> <div> </div> </template> When I build

Getting result from a sum on laravel collection

一曲冷凌霜 提交于 2019-12-13 00:44:56
问题 I am not getting the desired result from a collection with sum. Here is my controller code : $query2 = DB::table('token') ->whereDate('token.date','>=',$request->fdate) ->whereDate('token.date','<=',$request->tdate) ->select('date',DB::raw('date(date) as cdate'), DB::raw('token as refno'), DB::raw("(case when gate = 'IN' and type='CAR' then date else null end) as intime"), DB::raw("(case when gate = 'OUT' and type='CAR' then date else null end) as outtime"), DB::raw("(case when gate = 'OUT'