laravel-5.3

Laravel 5.3 - How to keep the session message until the users logs out

懵懂的女人 提交于 2019-12-13 07:30:01
问题 I am sending a welcome message to user after registration. I have modified the trait method in my controller like so: public function register(Request $request) { $this->validator($request->all())->validate(); event(new Registered($user = $this->create($request->all()))); $this->guard()->login($user); Session::set('message','messages.welcome'); return redirect($this->redirectPath())->with('message', 'messages.welcome'); } I have also tried $request->session()->put('message','messages.welcome'

Laravel MongoDB library 'jenssegers/laravel-mongodb' hasMany relationship is not working

自闭症网瘾萝莉.ら 提交于 2019-12-13 07:21:36
问题 I am using MongoDB library https://github.com/jenssegers/laravel-mongodb version 3.1.0-alpha in Laravel 5.3.28 I have two collections in MongoDB and I want to make a hasMany relation b/w them. Means each Employee performs many tasks. I have used reference and added employee_ids in the task collection. Below are my code: MongoDB: 1st Collection: Employee { "_id" : ObjectId("586ca8c71a72cb07a681566d"), "employee_name" : "John", "employee_description" : "test description", "employee_email" :

Laravel language on Auth validation error

£可爱£侵袭症+ 提交于 2019-12-13 07:07:10
问题 I would like to use the laravel default functionality to show the error, but in another language. I don't need a "nice name", but a translation for the **:attribute value in lang files. Right now if I just use: <input type="text" placeholder="{{ trans('generic.phone') }}" name="phone" value="{{ old('phone') }}"> @if ($errors->has('phone')) <span class="help-block"> <strong>{{ $errors->first('phone') }}</strong> </span> @endif it works perfectly, because the :attribute takes the field phone ,

Laravel session out the box not working

本小妞迷上赌 提交于 2019-12-13 07:04:04
问题 I've created a new laravel installation and the first thing I'm trying to do it just confirm sessions are working: Route::get('/', function () { $value = Request::session()->get('key'); if (is_null($value)) { Request::session()->set('key', md5(rand())); } dd(Request::session()->get('key')); return view('welcome'); }); I'm hoping here that session 'key' is stored, then, on the next refresh, it will output (dd) the same key value each time. However, it doesn't. I get a different value for 'key'

How to get response ajax on the vue.js 2?

天涯浪子 提交于 2019-12-13 06:17:44
问题 My code is like this : <template> <a href="javascript:" class="btn btn-block btn-success" @click="addFavoriteStore($event)"> <span class="fa fa-heart"></span> Favorite </a> </template> <script> export default{ props:['idStore'], mounted(){ this.checkFavoriteStore() }, methods:{ addFavoriteStore(event){ alert('tost'); event.target.disabled = true const payload= {id_store: this.idStore} this.$store.dispatch('addFavoriteStore', payload) setTimeout(function () { location.reload(true) }, 1500); },

Why is there no bcc in sender's email if combine laravel notification & Laravel mailable?

好久不见. 提交于 2019-12-13 03:55:47
问题 I use Laravel 5.3 My controller like this : auth()->user()->notify(new ConfirmOrder($invoice)); My notification like this : <?php ... class ConfirmOrder extends Notification implements ShouldQueue, ShouldBroadcast { use Queueable; private $data; public function __construct($data) { $this->data = $data; } public function via($notifiable) { return ['mail']; } public function toMail($notifiable) { $mail_myshop = explode(',', config('app.mail_myshop')); return (new ConfirmOrderMail($this->data,

How can I pass input file with vue.js 2?

只谈情不闲聊 提交于 2019-12-13 03:46:34
问题 My vue component like this : <template> <div class="modal" tabindex="-1" role="dialog"> ... <div class="form-group"> <label for="change-image">Change image</label> <input type="file" name="replace" v-on:change="changeImage"> </div> <div class="form-group"> <label for="alt-image">Alt attr</label> <input type="text" class="form-control" v-model="altImage"> </div> <div class="checkbox"> <label> <input type="checkbox" v-model="mainCover"> Set Cover </label> </div> <button type="button" class="btn

NotFoundHttpException in RouteCollection.php (line 179) in Laravel 5.4

痞子三分冷 提交于 2019-12-13 00:54:47
问题 Hello I am facing NotFoundHttpException error when i access /login or /register when i run the php artisan make:auth command, routes are also created their, but /login or /register is not working for me, let me share my code with you. Web.php Auth::routes(); Route::get('/home', 'HomeController@index')->name('home'); when i check my browers concole its showing this error GET http://localhost/laravel5authprc/login 404 (Not Found) 回答1: Try to access http://localhost/laravel5authprc/index.php

Laravel 5.3 - Single Notification File for Different User Collections?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 23:32:13
问题 Given 100 followers, once I complete a todo, a notification is fired. The issue is 80 of them want email only notification, the other 20 want sms only notification. Does that mean I need to use 2 different notification calls like this: Notification::send($emailOnlyUsers, new TodoCompletedEmail($todo)); which has only the mail channel, and then: Notification::send($smsOnlyUsers, new TodoCompletedSms($todo)); which has only the sms channel? Or is it possible to have the logic of $emailOnlyUsers

How can i add TrimString Middleware in laravel 5.3?

时间秒杀一切 提交于 2019-12-12 22:47:48
问题 Just came to know that Laravel 5.4 has an awesome feature TrimString , which removes the white spaces from any input. I want this middleware in my 5.3 project, any idea how to do that? I just copied the middleware from GitHub repo of Laravel but it is not working. Thanks 回答1: If you want to use this feature in Laravel 5.3 . Add these two classes into your App\Http\Middleware https://github.com/laravel/framework/blob/5.4/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php https:/