laravel-5.4

Including a css file in a blade template?

◇◆丶佛笑我妖孽 提交于 2019-12-03 11:21:52
问题 I want to include a css file in my Laravel blade template. I've tried: @include(public_path('css/styles.css')) But it says view does not exist. It does exist. How can I include a css file? Please note, I know this is not the correct way to link css files, but for my use case it is (I'm not building a website). 回答1: @include directive allows you to include a Blade view from within another view, like this : @include('another.view') Include CSS or JS from master layout <link href="{{ asset('css

The “--queued” option does not exist in Laravel 5.4

别来无恙 提交于 2019-12-03 10:27:29
问题 I'm going to create Queue job for mailing. once I hit the artisan command in command prompt php artisan make:job SendSMSMessages --queued I got the issue as is follow. The "--queued" option does not exist. I'm using Laravel 5.4 Please anyone can help me for the same. I have searched a lot but didn't found any good solutions. Thanks 回答1: The option --queued, was introduced in Laravel 5.0, and remained an option until version Laravel 5.1 https://laravel.com/docs/5.1/queues#writing-job-classes

multiple prefix with the same route group

↘锁芯ラ 提交于 2019-12-03 09:50:42
im writing a fairly simple website for a school ... this website has news , articles , video clips ... etc the way it works is in the home page we present visitor with some lessons like >math >geography >chemistry user selects 1 on these and website contents changes based on the user selection for example if user selects math he will see news , article , videos about math and so on ... right now this is what im doing (pleas ignore syntax errors) Route::group(['prefix'=>'math'], function () { Route::get('/news', 'NewsController@index')->name('news_index'); Route::get('/article',

Allow login using username or email in Laravel 5.4

冷暖自知 提交于 2019-12-03 08:30:01
问题 Now I've followed the Laravel documentation on how to allow usernames during authentication, but it takes away the ability to use the email. I want to allow users to use their username or email to login. How do I go about this? I've added this code to the LoginController as per Laravel's Documentation and it only allows username for login. I want it to accept username or email for login. public function username () { return 'username'; } 回答1: Follow instructions from this link: https:/

Changing Laravel 5.4 password encryption and table column names

ぃ、小莉子 提交于 2019-12-03 08:01:38
I am trying to integrate the auth in laravel 5.4 within an existing database where the user and password fields have other names ( memberid , passwordnew_enc ). With the bellow changes and forcing the create function in RegisterController to use MD5 I managed to make the registration work. It also logins fine after registration. However the actual login form returns: These credentials do not match our records. So far I have changed the User.php public function getAuthPassword() { return $this->passwordnew_enc; } and public function setPasswordAttribute($value) { $this->attributes['password'] =

How to run multiple Laravel projects at same time?

老子叫甜甜 提交于 2019-12-03 07:15:50
To run one laravel project we only need to type "php artisan serve". and it will be available on port 8000. But sometimes we need to run multiple projects at the same time. How can we do this? tl;dr one cannot have more than one listener per TCP port at the same time. If you need more web server instances try another port: php artisan serve --port=8001 then go to http://localhost:8001 Reference: Can two applications listen to the same port? You can also run web server on multiple port in PHP application by the following command. php -S localhost:8000 php -S localhost:8080 First run your first

Disable error reporting entirely in Laravel production?

核能气质少年 提交于 2019-12-03 06:47:45
I would like to disable error reporting entirely on production, because we have some very old code we still need to fix but for now does work (yes I don't like it either). We cannot fix everything in a few days, so we need to just supress the warnings and exceptions like we always did. The real problem is that it already throws an exception on a simple lazy bug like (because var is not defined) if(!$var) { // do whatever } tried APP_DEBUG=false APP_LOG_LEVEL=emergency display_errors(false); set_error_handler(null); set_exception_handler(null); But it still shows an ErrorException Undefined

How to use bootstrap 4 in Laravel 5.4?

為{幸葍}努か 提交于 2019-12-03 03:25:42
I installed bootstrap 4 using npm on my laravel app. But I think bootstrap 3 working behind not bootstrap 4. using command: npm install npm install bootstrap@4.0.0-alpha.6 Did I left something to do? Or do I need to manually import bootstrap to assets/sass/app.scss file or else? You have to manually change the link to bootstrap from resources/assets/sass/app.scss . You will see this line @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; Replace with @import "node_modules/bootstrap/scss/bootstrap"; Rahul Do flowing with new or empty Laravel project. remove the bootstrap entry

How to use patch request in Laravel?

冷暖自知 提交于 2019-12-03 02:25:07
There is entity User that is stoted in table Users Some fields in this table are null by default. I need to update these fields and set not null data. For this I try to use PATCH method in Laravel: Routing: Route::patch('users/update', 'UsersController@update'); Controller: public function update(Request $request, $id) { $validator = Validator::make($request->all(), [ "name" => 'required|string|min:3|max:50', "email_work" => 'email|max:255|unique:users', "surname" => 'required|string|min:3|max:50', "tel" => 'required|numeric|size:11', "country" => 'required|integer', "region" => 'required

How to integrate Swagger in Lumen/Laravel for REST API?

霸气de小男生 提交于 2019-12-03 01:24:46
I have built some REST API in Lumen micro framework and it's working fine. Now I want to integrate Swagger into it so the API will be well documented on future use. Has anyone done this? Steps to follow for Laravel Lumen 5.7 with swagger using OpenApi 3.0 specs (this governs the way you write annotations so that swagger documentation is generated) I reached this adjusting on @black-mamba answer in order to make it work. 1. Install swagger-lume dependency (which also installs swagger) composer require "darkaonline/swagger-lume:5.6.*" 2. Edit bootstrap/app.php file make sure $app->withFacades();