laravel-5.3

Internal Server error during file uploading in laravel5.3

最后都变了- 提交于 2019-12-11 07:03:06
问题 I am trying to upload a file in laravel.But every time i hit the submit button it gives me the internal server error in the console. I have checked the rote with a get request to check if the controller function is working properly and it works fine. Can any say what is the problem? here is my code samples route code Route::post('/storefile','PublicationController@storeFile'); controller public function storeFile(Request $request){ if($request->ajax()){ echo "got"; } else echo "not ajax"; }

Format FormRequest Validation Error Response

笑着哭i 提交于 2019-12-11 06:48:34
问题 With reference to this stack question and answer I'm trying to format the response of my error validations to a more simplified format...thus in a custom App\Http\Requests\CustomRequest I have public function rules() { return [ 'amt' => 'required|numeric|min:1000', 'year' => 'required|numeric|min:' . date_format(new \DateTime, 'Y'), 'user_id' => 'required', 'ratio' => 'required' ]; } public function response(array $errors) { if ($this->expectsJson()) { return response()->json(['messsage'=>

upgrading to laravel 5.3, “Call to undefined method Illuminate\Database\Query\Builder” error [duplicate]

南楼画角 提交于 2019-12-11 06:37:07
问题 This question already has answers here : Call to undefined method Illuminate\Database\Query\Builder::lists() when seeding after updating to Laravel 5.3 (5 answers) Closed 3 years ago . I have a Laravel 5.2 project that works great. I tried to upgrade it to Laravel 5.3 and it gave errors such as: BadMethodCallException in Builder.php line 2448: Call to undefined method Illuminate\Database\Query\Builder::friends() or any other methods in my User.php model have the same error. For example, when

stream_set_blocking() expects parameter 1 to be resource, null given

不羁的心 提交于 2019-12-11 06:17:20
问题 I want to sent emails from online server with Laravel 5.4. I don't know if the problem is with my code or the server. I have hosting from easyname.com. This is my .env file MAIL_DRIVER=smtp MAIL_HOST=smtp.easyname.com MAIL_PORT=465 MAIL_USERNAME=info@mydomain.com MAIL_PASSWORD=mypasword MAIL_ENCRYPTION= This is my config/mail.php file <?php return [ /* |-------------------------------------------------------------------------- | Mail Driver |---------------------------------------------------

Run config clear on browser

你。 提交于 2019-12-11 06:15:32
问题 I need to run php artisan config:clear on my app that is online, the only issue is that I have only the FTP credentials and DB, and not the SSH to run on the terminal, how can I run this command without the terminal? Already tried looking on the forum and didn't found any question related with my issue but didn't found any answer for it. 回答1: You can call the artisan command from anywhere in your PHP code block. $exitCode = Artisan::call('config:clear'); More info can be found here https:/

How to create an multidimensional array in Laravel/PHP

∥☆過路亽.° 提交于 2019-12-11 05:46:18
问题 I'm trying to store some values in one array, where each element has its child element. Please find the code: $children = $user->relations()->wherePlanId($selectplan)->get(); foreach($children as $ch) { $child[] = $ch->pivot->child; $subuser = User::find($ch->pivot->child); if($subuser){ $subchildren = $subuser->relations()->wherePlanId($selectplan)->get(); foreach($subchildren as $subchild) { $subchildid[] = $subchild->pivot->child; } } else { $subchildid[] = NULL; } } I want to store

Laravel 5 Uploading and display image

本小妞迷上赌 提交于 2019-12-11 04:57:23
问题 Basically I want to upload an image and display it to an user, at the moment when image is selected, nothing happens I get no error mistakes or anything else and I am wondering what is going on. Here is my code: <form action="{{ action('BuilderController@testing') }}" role="form" method="POST"> <input class="form-control filestyle margin images" data-input="false" type="file" data-buttonText="Upload Logo" data-size="sm" data-badge="false" /> </form> <div class="logo"> <img class="images" id=

Stop Validate the second input if the first input failed in laravel validation

▼魔方 西西 提交于 2019-12-11 04:26:13
问题 I have two inputs (password , email) which i want to validate them. Is it possible to check if the password field validations failed Don't validate email field? public function rules() { return [ 'password' => 'required|validate_client_password', 'email' => 'required|email|max:255' ]; } 回答1: Check out required_with and required_with_all and ... This may be resolve your problem. required_with:foo,bar,... The field under validation must be present and not empty only if any of the other

How can I customize font and page in laravel dompdf?

萝らか妹 提交于 2019-12-11 04:25:50
问题 I get from here : https://github.com/barryvdh/laravel-dompdf My controller is like this : public function listdata() { $pdf=PDF::loadView('print_tests.test_pdf'); $pdf->setPaper('L', 'landscape'); return $pdf->stream('test_pdf.pdf'); } My view is like this : <script type="text/php"> if ( isset($pdf) ) { $x = 72; $y = 18; $text = "{PAGE_NUM} of {PAGE_COUNT}"; $font = $fontMetrics->get_font("Arial", "bold"); $size = 6; $color = array(0,0,0); $word_space = 0.0; // default $char_space = 0.0; //

Variable undefined error in laravel blade view

爱⌒轻易说出口 提交于 2019-12-11 04:04:30
问题 Hey as i am passing a blade view which is having it own controller also i am including it into the view which does not have its own controller. it gives me an undefined variable error can any one help me how to it. I have a view which does not have any controller only have Route like this Route::get('index', function () { return view('index'); }); in this view i am passing another view which having its own controller and also having some data from an array. but after using this view inside