laravel-5.2

Why am I getting a 422 error code?

不羁岁月 提交于 2019-12-12 10:37:17
问题 I am making a POST request, but unable to get anything besides a 422 response. Vue.js client code: new Vue({ el: '#app', data: { form: { companyName: '', street: '', city: '', state: '', zip: '', contactName: '', phone: '', email: '', numberOfOffices: 0, numberOfEmployees: 0, } }, methods: { register: function() { this.$http.post('/office-depot-register', this.form).then(function (response) { // success callback console.log(response); }, function (response) { // error callback console.log

Laravel 5 authenticate users through external API

匆匆过客 提交于 2019-12-12 09:41:30
问题 I'd like to know is it possible to extend the built-in authentication to use an external API to authenticate a user? I'm a Laravel newbie, so I'd appreciate your help. I'm making a custom app in Laravel 5.2 for my client, but I don't a direct access to their database server and I can only call their API to get users' details. Thanks. 回答1: If I understood correctly you want to log users from APIs like facebook, twitter or github for example ? If that's so you need to use a laravel package

laravel fcm push notification with brozot/Laravel-FCM not working on ios but working fine with android

a 夏天 提交于 2019-12-12 09:41:03
问题 Even ios can get notification from fcm console. Controller function : public function push(Request $request) { $validator = Validator::make($request->all(), [ 'title' = > 'required', 'body' = > 'required', 'token' = > 'required', 'type' = > 'required', 'id' = > 'required', ]); if ($validator->fails()) { $this->throwValidationException( $request, $validator ); } $title = $request['title']; $body = $request['body']; $type = $request['type']; $id = $request['id']; $dataarray = array( "id" = >$id

How to insert a post with multi category and with multi column deferent category in laravel?

喜夏-厌秋 提交于 2019-12-12 09:24:02
问题 Hello all I am a new laravel, I have problem with my project. I have 2 table: posts: id title category_id category: id name(PHP, Laravel, Ruby) Ex:I want result like, if I am insert a post into posts database title=Jonh and chosse two category name(PHP,Laravel), and the result will two column like posts(id=1 title(jonh) category_id(1), id=2 title(jonh) category_id(2)) but it still not work I try to find in google and youtube follow and it not work, and here is my code: View(create.blade.php)

Run function from Button or URL in Laravel

回眸只為那壹抹淺笑 提交于 2019-12-12 07:06:43
问题 I have the following test function, that I want to call directly from my URL or by clicking a link from my blade view. public function callMeDirectlyFromUrl() { return "I have been called from URL :)"; } My Question: Is it possible to call a function directly from button-click or URL link from blade view in Laravel? 回答1: Here is the solution: We assume you have a function callMeDirectlyFromUrl in YourController , here how you can call the function directly from URL, Hyperlink or Button.

DecryptException in BaseEncrypter.php line 48: The MAC is invalid. laravel 5.2

强颜欢笑 提交于 2019-12-12 07:01:39
问题 I know this question has already been asked. But none of them solve my issue. I am facing the issue : DecryptException in BaseEncrypter.php line 48: The MAC is invalid. I checked my .env file there is no space in APP_DEBUG and APP_KEY Tried to generate new key but nothing worked out. Laravel Framework version 5.2.45 回答1: After surfing for around two hours , tried so many solution form different sources but none of them solved my problem. There may be reason then .env file have space in APP

How to maintain the dpi (dots per inch) of an image in laravel 5.2 using intervention package?

旧巷老猫 提交于 2019-12-12 06:25:06
问题 I am using Laravel 5.2. I have almost done the resizing of an image that runs fine. But i am facing one problem When i upload an image of 300 dpi it reduces the dpi to 96 dpi. I don't know what i am doing wrong.I am using Intervention Package of laravel5.2. Here i have done so far:- // Input::file('image') -> upload file having dpi of 300 $height = 6048; //upload image height $width = 4032; //upload image width xxlheight = ($height*60)/100; $xxlwidth = ($width*60)/100; $xxlFileName = str

How to keep POST method's input values with post/redirect/get?

删除回忆录丶 提交于 2019-12-12 05:42:03
问题 Using the post/redirect/get pattern, you can prevent duplicate form submission. For example, you can prevent a visitor of your online shopping website from ordering the same item twice. However, is it possible to block such a duplicate action but receive and maintain input values, which are send with POST, on DOM after the visitor refreshes the page without using AJAX call? To clarify the point, here is an example. You have only one page, which has a <form> , several <input> and submit button

Laravel 5.2 Avoiding public folder and open directly from root in localhost

北城余情 提交于 2019-12-12 05:38:29
问题 The reason why I'm doing that is Laravel has the document root in a subdirectory is so that you don't have to expose your code to the public. The folder structure in my localhost is Test Test/laravel/ Test/public_html/ where laravel contains all the folder of root without the public folder and public_html contains the public files. And I have changed in below lines in public_html/index.php : require __DIR__.'./../laravel/bootstrap/autoload.php'; $app = require_once __DIR__.'./../laravel

Integrity constraint violation: 1048 Column 'class_code' cannot be null

試著忘記壹切 提交于 2019-12-12 05:17:50
问题 My controller: $class = new joinclass(); $class -> user_id = Auth::user()->id; $class -> class_code = $request['class_code']; $class -> save(); Class_code is another table column name. It's not primary key or foreign key. 回答1: Your field "class_code" contain "nothing" (null) and Your MySQL server is running in "strict" mode. As of MySQL 5.7.5, the default SQL mode includes STRICT_TRANS_TABLES , which is exactly the cause of your headache. To change your server's mode, edit your my.cnf (or my