laravel-5.2

laravel 5.2 pass data to registration view

。_饼干妹妹 提交于 2019-12-23 11:58:27
问题 I'm using laravel 5.2 and I wrote this command to automatically add routes and views of authentication: php artisan make:auth Now I want to pass data to registration view but I don't find where to do that, I assume that it should be with a code like that: Route::get('register', 'Auth\AuthController@showRegistrationForm'); But in routes.php I have this: Route::auth(); And in Auth\AuthController there are only two methods: validator create 回答1: register user class is in this file \vendor

Laravel 5.2 named route usage with variable parameter

。_饼干妹妹 提交于 2019-12-23 09:07:25
问题 I have a route like this: // Open New Subscription page Route::get('/account/subscriptions/create/{menu}', ['uses' => 'Subscriptions\SubscriptionController@create', 'as' => 'subscription.create']); In my blade template I use the named route like this: <a href="{!! route('organisations.index') . "/p11-c3" !!}"> But this format does not work. How do I pass the variable menu a value while still using the named route (rather than hard coding a url in the href )? 回答1: You can pass your route

Laravel 5.2 artisan optimize - php_strip_whitespace failed to open stream: No child processes

*爱你&永不变心* 提交于 2019-12-23 07:48:50
问题 Since upgrading to Laravel 5.2 from 5.1, when running artisan optimize on CircleCI, running PHP 5.6.14, I am getting [ErrorException] php_strip_whitespace(/var/laravel/project/root): failed to open stream: No child processes Where /var/laravel/project/root is the directory where composer.json and vendor reside. The command runs fine on my dev box running PHP 5.6.11-1ubuntu3.1. I followed the official 5.1 to 5.2 upgrade guide. Exception trace: () at /var/laravel/project/root/vendor

Laravel 5.2 validation check if value is not equal to a variable

爷,独闯天下 提交于 2019-12-23 07:39:16
问题 In my instance one user is inviting another I would like to check if the user they are inviting is not themselves. Thus I have two variables incomming email and user->email $this->validate($request, [ 'email' => 'required|email', ]); How can I add that validation rule to the validation call? 回答1: You can use not_in , which allows you to specify a list of values to reject: $this->validate($request, [ 'email' => 'required|email|not_in:'.$user->email, ]); 回答2: You can use different:field

Grammar::parameterize() must be of the type array

对着背影说爱祢 提交于 2019-12-23 06:58:07
问题 I got this error Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, when I tried add array[] in my View using select form. But when I removed it I didn't get any error. I'm just trying to input a multiple value in my select list. Do I need to use foreach for this? View <div class = "form-group {{ $errors->has('approver') ? ' has-error' : '' }}"> <label for = "approver" class = "control-label">Approver:</label> <select name = "approver[]"

Image dose not move at folder path

眉间皱痕 提交于 2019-12-23 05:13:45
问题 I already given 777 permission to my images folder. Charts Table is also saving all record of image. I am going to attach table: charts structure here. public function store(Request $request) { $input = $request->all(); $tradeID= Auth::user()->trade()->create($input); if($file = $request->file('file')) { $name = time() . $file->getClientOriginalName(); $file->move('images', $name); $photo = Chart::create(['file'=>$name]); $input['photo_id'] = $photo->id; } $tradeID->chart()->create($input); }

How to get and validate application/json data in Laravel?

不想你离开。 提交于 2019-12-23 05:07:39
问题 I send data from client to server in application/json content type. Then I try to take this information in server side like as: public function register(Request $request) { $data = $request->json()->all(); var_dump($data); die(); } It returns me empty array() Also I tried to validate incoming POST using this: $validator = Validator::make($request->json()->all(), []); How to get and validate application/json data in Laravel? I get POST data like as: dd($_POST); array:1 [▼ "application/json" =>

How to make Laravel whereIn not sorted automatically

↘锁芯ラ 提交于 2019-12-23 03:33:29
问题 my array from $temp is Array ( [0] => 22 [1] => 26 [2] => 20 [3] => 24 ) or 22|26|20|24 when I use whereIn like this $robjeks = DB::table('objek')->whereIn('id', $temp)->get(); the result is 20|22|24|26| it's automatically sorted. I want it's not sorted. how to make it same like 22|26|20|24 ? thanks for your attention. 回答1: This has nothing to do with Laravel. Read here first: avoid Sorting by the MYSQL IN Keyword Then, to do this, you can use this code: $temp = [22, 26, 20, 24]; $tempStr =

Laravel Excel validation

好久不见. 提交于 2019-12-23 03:24:18
问题 i have installed the maatwebsite/excel package for laravel. It works fine. My problem is how to handle it after i check the file. The upload() function in which i show to file forum and where i upload the file is here: public function upload(Request $request) { $orientation = $request->get('orientation'); if($request->file('file')) { $status = Excel::load(Input::file('file'), function ($reader) use ($orientation) { return self::upload_excel_files($reader, $orientation); }); if($status) {

Laravel 5 on IIS7 does not work with web.config

折月煮酒 提交于 2019-12-23 03:24:09
问题 I have a simple Laravel 5 app. It was developed on Xampp, and worked perfectly. I copied it onto the production server, and it does not work. Something is wrong with the web.config file, because if I remove it, then the app works perfectly with index.php/path My webconfig is as follows: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Rule 1" stopProcessing="true"> <match url="^(.*)/$" ignoreCase="false" /> <action type="Redirect"