laravel-5.5

Cannot get TrustProxies middleware to work

前提是你 提交于 2019-12-11 15:43:50
问题 After pointed in the right direction here Laravel 5.4 relative instead of absolute 302 redirects I've been trying to get Laravel TrustProxies middleware to work, but seems to be ignoring X_FORWARDED_PROTO header. My scenario My app in Laravel (just upgraded from 5.4 to 5.5) is behind a load balancer, which translates all traffic from HTTPS to HTTP. My problem All redirects are going over HTTP instead of original protocol HTTPS. Attempted Solution Upgrade from Laravel 5.4 to 5.5 and take

Laravel Eloquent one to many relationship, dynamically adding query to the related table

谁说胖子不能爱 提交于 2019-12-11 15:39:51
问题 I have asked a question here yesterday (Laravel Eloquent query build select min value). From that i am updating my query to select rooms. My Previous query: $buildquery=Room:: with(['hotel' => function ($query) { $query->where('status', 0); }]) ->with('image')->with('amenities'); if ($request->filled('location_id')) { $buildquery->Where('city', $request->location_id); //print_r($request->location_id); } // If amenities is there add it to query if($request->filled('amenities')){ $amenities =

could not find driver in laravel

半世苍凉 提交于 2019-12-11 14:18:37
问题 As I run php artisan migrate command it output In Connection.php line 664: could not find driver (SQL: select * from information_schema.tables where t able_schema = employee and table_name = migrations) In PDOConnection.php line 47: could not find driver In PDOConnection.php line 43: could not find driver and also i have pdo enabled for mysql, pgsql, sqlite im using ubuntu 16 and PHP Version 7.2.8 and laravel 5.5 回答1: Use php -m command to check whether mysql, pgsql, sqlite modules are

How to add relations to notifications? And get the related data in json

拜拜、爱过 提交于 2019-12-11 14:15:56
问题 I am trying to create relations, and when notifications are fetched via $user->unreadNotifications I want to control which fields are shown, and fetch the relations. I cannot figure out where to do this. I did the following: php artisan notifications:table php artisan make:migration add_relations_to_notifications_table In this new migration I added requester_id . $table->integer('requester_id')->unsigned()->nullable(); $table->foreign('requester_id')->references('id')->on('users')->onDelete(

Add new columns to existing table in a migration in Laravel

﹥>﹥吖頭↗ 提交于 2019-12-11 12:25:28
问题 I want to add some new columns in my existing table users in laravel. I have already googling for that and following those search I have already created migration using the command php artisan make:migration add_columns_to_users . add_columns_to_users.php public function up() { Schema::table('users', function($table) { $table->string('address'); $table->string('city'); $table->string('tribe'); $table->string('country'); $table->integer('student_id'); $table->string('tribe_university_name');

Handling PostTooLargeException in Laravel 5.5

假装没事ソ 提交于 2019-12-11 11:57:12
问题 I am trying to handle PostTooLargeException in my Laravel 5.5 application. When I trying to upload too big file through my form I receive PostTooLargeException which I successfully catch in app\Exceptions\Handler.php , but on that step I would like to redirect user back to the page with form and show an error message. I wrote following code: class Handler extends ExceptionHandler { ... public function render($request, Exception $exception) { ... if($exception instanceof PostTooLargeException)

Laravel Passport Password Reset API route

谁说我不能喝 提交于 2019-12-11 07:56:30
问题 I'm all set up with Passport in 5.5 and have the auto generated Auth\ForgotPasswordController and Auth\ResetPasswordController controllers. However whereas /oauth/token was provided magically for me, there don't appear to be such routes for password reset when using the API. What should my API routes look like? Currently I've experimented with Route::group(['prefix' => 'password'], function () { Route::post('/email', 'Auth\ForgotPasswordController@sendResetLinkEmail'); Route::post('/reset',

Load just ids of relation (pluck)

試著忘記壹切 提交于 2019-12-11 07:13:30
问题 I have a simple app, using Laravel 5.5.13. public function index() { return Pet::all(); } This lists all pets. I have many to many relation where many users can own a the same pet (the pet's human family). I want to load those users. Doing return Pet::with('users')->get(); does the trick, however it loads all kind of excessive infromation, like the users api_token etc, I just want to pick some fields, like id and name: I was hoping to just get users: [1, 12] for the example in the screenshot

How to include js file from 'resources' folder (Laravel 5.5)

梦想与她 提交于 2019-12-11 05:08:03
问题 i used next code to include my js file Meta::addJs('admin_js', '/resources/assets/admin_js/admin_app.js'); File exists but in console i see status 404. If i move file to 'public' folder - all ok. But i want that this file be stored in 'resources' directory 回答1: you have to move js files to public or store into storage and make symlinks. or you need to create symlinks the resources directory to a public directory(which is not recommended). you need to use the most recommended and effective

Laravel 5.5 + Vue.js 2.x project not working on npm run dev

佐手、 提交于 2019-12-11 04:39:20
问题 when I have created the new project for Laravel 5.5 + Vue.js 2.x , I have the problem. This is the message after I have run this. npm install npm run dev > @ dev /Volumes/Work/Work/Vue/CRUD > npm run development > @ development /Volumes/Work/Work/Vue/CRUD > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 95% emitting DONE Compiled successfully in 2830ms 6:01:15 PM internal/child_process.js