laravel-5.4

Dropzone autoProcessQueue: false not working

夙愿已清 提交于 2019-12-24 01:29:37
问题 I'm trying to upload files on button click. I have followed so much tutorials/questions like, Upload all files with a button, Dropzone.js post request in laravel 5.4. But didn't get success. This is my view file code, <form action="{{ url('admin/candidate/file-upload') }}" method="post" class="dropzone" id="my-dropzone"> {{ csrf_field() }} <div class="dz-message"> <h3>Drop images here or click to upload.</h3> </div> </form> And this is my JS file code (in document ready block), //DropZone -

Laravel Testing login Credential using phpunit + multiprocess

拜拜、爱过 提交于 2019-12-23 22:11:45
问题 I'm pretty new on unit testing and I want to try to test my login page my Goal for this unit are : -> if it match in database -> redirect to route '/' -> if not -> redirect to route '/login' <?php namespace Tests\Feature; use App\Domain\Core\Models\User; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Session; use Tests\TestCase; use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing

How to set header for all requests in route group

ぐ巨炮叔叔 提交于 2019-12-23 19:27:06
问题 I'm creating an API with Laravel 5.4 and it all works well. I've used the following middleware => auth:api like this Route::group(['middleware' => 'auth:api'], function(){ Route::get('URIValue', ControllerName@action) //Example }); I've tested it with postman and it works well when the request header contains the following keys and values : Authorization:Bearer api_token Accept:application/json When the api_token is invalid the unauthenticated function of the Handler class is executed. The

Laravel 5.4 --> forbidden 403 on files in Storage with 'public' visibility

蹲街弑〆低调 提交于 2019-12-23 18:52:59
问题 I have been getting an issue with Laravel and the Storage class. I have create an upload form for users to control images used as logos in their account. I use Laravel File Storage inspired by Flysystem . When I save an image, I proceed as follows : // Store the logo in the public filesystem, and define a 'public' visibility $logo = $request->file('logo')->store('logos/'.$account->id, 'public'); // Save the path in the database $account->update([ 'logo' => $logo ]); The upload works fine, I

Laravel Factory: Manual Increment of Column

こ雲淡風輕ζ 提交于 2019-12-23 11:56:18
问题 For the following factory definition, the column order needs to be sequential. There is already a column id that is auto-incremented. The first row's order should start at 1 and each additional row's order should be the next number ( 1 , 2 , 3 , etc.) $factory->define(App\AliasCommand::class, function (Faker\Generator $faker) { return [ 'user_id' => App\User::inRandomOrder()->first()->id, 'command' => $faker->word, 'content' => $faker->sentence, 'order' => (App\AliasCommand::count()) ? App

Laravel Factory: Manual Increment of Column

冷暖自知 提交于 2019-12-23 11:56:16
问题 For the following factory definition, the column order needs to be sequential. There is already a column id that is auto-incremented. The first row's order should start at 1 and each additional row's order should be the next number ( 1 , 2 , 3 , etc.) $factory->define(App\AliasCommand::class, function (Faker\Generator $faker) { return [ 'user_id' => App\User::inRandomOrder()->first()->id, 'command' => $faker->word, 'content' => $faker->sentence, 'order' => (App\AliasCommand::count()) ? App

Check whether Laravel Controller Action is defined

*爱你&永不变心* 提交于 2019-12-23 10:38:44
问题 I have an application where I will be storing links in the database allowing the user to assign actions to the link. I want to avoid the situation where the action does not exist and I get this error; Action App\Http\Controllers\PermissionController@index2 not defined. So I would like to check whether an action exists and has route. If possible in blade but anywhere else is fine. 回答1: There isn't any built in way to do this. But we have a action helper method which generates route url based

Example PHPUnit Test on Laravel 5.4 fails with 404

≯℡__Kan透↙ 提交于 2019-12-23 08:29:30
问题 I can my project on Laravel 5.4 from link: localhost:8888/streaming_statistic/public I have a test: <?php namespace Tests\Feature; use Tests\TestCase; use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseTransactions; class ApiTest extends TestCase { public function testBasicTest() { $response = $this->get('/'); $response->assertStatus(200); } } I run all tests with command ./vendor/bin/phpunit But

enable Vue Devtools inspection in laravel 5.4

别等时光非礼了梦想. 提交于 2019-12-23 05:46:10
问题 I want to start using Vue in my laravel 5.4 app. Without laravel i can see vue devtools inspection tab on chrome. But in my laravel app the Vue tab is not there in chrome console although the chrome vue devtool extension says Vue.js is detected. How can i enable the Vue devtool inspection in my laravel app? I tried Vue.config.debug = true; Vue.config.devtools = true; on my app.js file but no luck. Thanks. 回答1: try to re-populate vuejs preset: php artisan preset vue 来源: https://stackoverflow

Laravel 5 Auth is non object in Controller construct

一笑奈何 提交于 2019-12-23 05:27:40
问题 In app\Http\Controller there is a master controller class named Controller that all other controllers inherits. In any other controller the following code works fine: class OtherController extends Controller{ public function index(){ dd(\Auth::user()->id); } } However, in the Controller.php i.e the parent class, when I try to do something like that in the construct method I have got Trying to get property of non-object error: class Controller extends BaseController { use AuthorizesRequests,