laravel-5

How to get value of input in blade.php

跟風遠走 提交于 2021-02-10 06:33:30
问题 I need to get a value of input to use below, how to do that? I tried to like this but error says Undefined variable: name <div class="col-md-10 col-md-offset-1"> <input id="name" type="text" name="name" /> </div> <div class="col-md-10 col-md-offset-1"> @php $nameValue=$_GET['name']; @endphp <input id="name2" type="text" name="name2" value="{{$nameValue}}" /> </div> 回答1: You have to be aware that your input-values (here "name") ist only available after submitting the form. If you want to

How to get value of input in blade.php

邮差的信 提交于 2021-02-10 06:32:29
问题 I need to get a value of input to use below, how to do that? I tried to like this but error says Undefined variable: name <div class="col-md-10 col-md-offset-1"> <input id="name" type="text" name="name" /> </div> <div class="col-md-10 col-md-offset-1"> @php $nameValue=$_GET['name']; @endphp <input id="name2" type="text" name="name2" value="{{$nameValue}}" /> </div> 回答1: You have to be aware that your input-values (here "name") ist only available after submitting the form. If you want to

How to get value of input in blade.php

浪尽此生 提交于 2021-02-10 06:32:14
问题 I need to get a value of input to use below, how to do that? I tried to like this but error says Undefined variable: name <div class="col-md-10 col-md-offset-1"> <input id="name" type="text" name="name" /> </div> <div class="col-md-10 col-md-offset-1"> @php $nameValue=$_GET['name']; @endphp <input id="name2" type="text" name="name2" value="{{$nameValue}}" /> </div> 回答1: You have to be aware that your input-values (here "name") ist only available after submitting the form. If you want to

Applying string function in column Laravel 5.4

∥☆過路亽.° 提交于 2021-02-10 06:29:46
问题 I'm using the latest Laravel 5.4 I am trying to make a simple query to search users by name. The query written for MySQL looks like this: SELECT * FROM users WHERE upper(name) LIKE '%FOO%'; I'm trying to make it work with Eloquent. Things I've tried but failed: User::where('upper(name)', 'LIKE', '%FOO%')->get() DB::table('users')->where('upper(name)', 'LIKE', '%FOO%')->get() Both fail with the following error: Illuminate\Database\QueryException with message 'SQLSTATE[42S22]: Column not found:

Add headers in mail function laravel 5

时光毁灭记忆、已成空白 提交于 2021-02-08 21:30:26
问题 I am updating code from laravel 4 to laravel 5 In laravel 4 there is mail functionality implemented with some code like below Mail::send('emailtemplate.sample', $content_data, function ($message) use ($to_mail, $email_data, $from_name) { $message->from('admin@domain.com', 'admin')->to($to_mail)->subject($email_data->subject); $headers = $message->getHeaders(); $headers->addTextHeader('X-MC-PreserveRecipients', 'false'); }); I don't know how to replace $headers = $message->getHeaders(); and

Add headers in mail function laravel 5

梦想的初衷 提交于 2021-02-08 21:30:11
问题 I am updating code from laravel 4 to laravel 5 In laravel 4 there is mail functionality implemented with some code like below Mail::send('emailtemplate.sample', $content_data, function ($message) use ($to_mail, $email_data, $from_name) { $message->from('admin@domain.com', 'admin')->to($to_mail)->subject($email_data->subject); $headers = $message->getHeaders(); $headers->addTextHeader('X-MC-PreserveRecipients', 'false'); }); I don't know how to replace $headers = $message->getHeaders(); and

Laravel conditional unique validation

家住魔仙堡 提交于 2021-02-08 15:18:25
问题 Working with Laravel 5.4, I need to validate if the email field on the users table is unique only if the role_id field is not 999. In the Register Controller I did this: return Validator::make($data, [ 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'email' => [ 'required', 'email', 'max:255', Rule::unique('users')->where(function($query) { $query->where('role_id', '<>', 999); }) ], 'phone' => 'required|phone', 'password' => 'required|min:6|confirmed' ]); But when I try

Laravel conditional unique validation

风流意气都作罢 提交于 2021-02-08 15:15:11
问题 Working with Laravel 5.4, I need to validate if the email field on the users table is unique only if the role_id field is not 999. In the Register Controller I did this: return Validator::make($data, [ 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'email' => [ 'required', 'email', 'max:255', Rule::unique('users')->where(function($query) { $query->where('role_id', '<>', 999); }) ], 'phone' => 'required|phone', 'password' => 'required|min:6|confirmed' ]); But when I try

How do I enable error reporting in Laravel?

自作多情 提交于 2021-02-08 15:02:07
问题 I'm using Laravel 5.2 and I'm trying to import an excel sheet which contains more than 18000 records. the error below appeared. The localhost page isn’t working localhost is currently unable to handle this request. HTTP ERROR 500 I tried to change php.ini max_execution_time from 30 seconds to 300 seconds but nothing has been changed EDIT the apache error log file says: [:error] [pid 3680:tid 1724] [client ::1:54491] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to

How do I enable error reporting in Laravel?

妖精的绣舞 提交于 2021-02-08 15:01:26
问题 I'm using Laravel 5.2 and I'm trying to import an excel sheet which contains more than 18000 records. the error below appeared. The localhost page isn’t working localhost is currently unable to handle this request. HTTP ERROR 500 I tried to change php.ini max_execution_time from 30 seconds to 300 seconds but nothing has been changed EDIT the apache error log file says: [:error] [pid 3680:tid 1724] [client ::1:54491] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to