laravel-5.3

Registration error in Laravel

只愿长相守 提交于 2019-12-23 00:31:18
问题 I use the default auth/registration in Laravel 5.3. When I try to register new user I get error: FatalThrowableError in RegistersUsers.php line 33: Call to undefined method Illuminate\Auth\TokenGuard::login() I have made some changes in configuration Laravel: 'defaults' => [ 'guard' => 'api', 'passwords' => 'users', ], So, by default I use api guard 回答1: The authentication driver api you are trying to use is TokenBased. That means the server will issue your client a Token on successful

Unable to connect to mysql on digitalocean using workbench over ssh

你说的曾经没有我的故事 提交于 2019-12-22 11:37:40
问题 I have got my droplet set with the laravel app and database. Created my db while on putty ssh. Now when I am trying to connect to my mysql database as in image, i am getting error. Error: Authentication error, unhandled exception caught in tunnel manager, plese refer to logs for details. Note that my credentials are right, as that what I use to connect through putty. Any help on how can I see view my database? 回答1: Got this solved like this. Turns out this is an ssh level issue. The digital

Identifying and persisting guest users in Laravel

余生颓废 提交于 2019-12-22 08:36:18
问题 I am building an online store website as a side project with Laravel 5.3. My goal is to implement anonymous and authenticated shopping. Here are the Customer , Cart , and CartItem tables so far: // (1) customers table... table->increments('id'); $table->integer('user_id')->unsigned(); // -> User hasOne('App\Customer') rel. $table->string('first_name'); // last_name, dob, phone, etc. + timestamps // (2) carts table... $table->increments('id'); // -> Customer identification (and not user_id,

Pass multiple parameters to a blade directive

橙三吉。 提交于 2019-12-21 09:38:14
问题 I'm trying to create a blade directive to highlight some words that will return from my search query. This is my blade directive: class AppServiceProvider extends ServiceProvider { public function boot() { Blade::directive('highlight', function($expression, $string){ $expressionValues = preg_split('/\s+/', $expression); foreach ($expressionValues as $value) { $string = str_replace($value, "<b>".$value."</b>", $string); } return "<?php echo {$string}; ?>"; }); } public function register() { }

laravel passport revoke and prune event listener is not doing anything

我是研究僧i 提交于 2019-12-21 06:29:22
问题 I've added this two event listeners to my : EventServiceProvider /** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'Laravel\Passport\Events\AccessTokenCreated' => [ 'App\Listeners\RevokeOldTokens', ], 'Laravel\Passport\Events\RefreshTokenCreated' => [ 'App\Listeners\PruneOldTokens', ], ]; And in my AuthServiceProvider I have : public function boot() { $this->registerPolicies(); Passport::routes(); passport::$revokeOtherTokens; passport::

Return Collection after update()?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 05:23:07
问题 Using Raw, how to return collection of updated row? For example: $updated = DB::table('users')->where('id', 1)->update(['votes' => 123]); I was expecting dd($updated) to return updated row of collection but it returned 1. {{$updated->votes}} should return 123 回答1: That's not how it works. You can't expect this query will return you an object: $updated = DB::table('users')->where('id', 1)->update(['votes' => 123]); If you want to use Query Builder only as you mentioned in your question, you'll

Laravel 5.3 Notification Vs Mailable

末鹿安然 提交于 2019-12-20 17:37:46
问题 I am a little confused about whether to use Laravel's Notification or Mailable class. From what I understand, Mailables are used to send only emails whereas Notifications can be used to send emails and sms. In my application, I dont have plans to send sms notifications for now, so I am confused if I should just use the Mailable class in this case. My questions are: If I am only going to be sending emails notifications, is it better for me to use Mailables instead of Notifications? If each

Summation query using groupBy() function in laravel

心已入冬 提交于 2019-12-20 06:34:25
问题 A table where X, Y and Z have some individual amounts. Sample data: Name | Amount | Date —————|————————|————————— X | 100 | 15-11-17 Y | 50 | 15-11-17 X | 50 | 15-11-17 Z | 70 | 15-11-17 Z | 30 | 15-11-17 Now I want to show a table where X will return one row with the summation of it's two values in the same date. Expected result: Name | Amount | Date —————|————————|————————— X | 150 | 15-11-17 Y | 50 | 15-11-17 Z | 100 | 15-11-17 So what is the laravel query for that? I use groupBy(). But

How can I use lang class laravel in vue.js 2?

匆匆过客 提交于 2019-12-20 05:42:15
问题 My vue component like this : <template> <ul class="nav nav-tabs nav-tabs-bg"> <li role="presentation" v-for="item in tabs"> 1. failed -> {{ item.name }} 2.success -> {{trans('purchase.payment.tab')}} </li> </ul> </template> <script> export default { data() { return { tabs: [ {name: "trans('purchase.payment.tab')"} ] } } } </script> My lang in laravel(resources/lang/en/purchase.php) like this : <?php return [ 'payment' => [ 'tab' => 'Payment Status', ], ... ]; If the component vue executed,

How to solve route not defined in laravel 5.3?

。_饼干妹妹 提交于 2019-12-20 05:39:21
问题 My controller code is like this : public function store(CreateUserRequest $request) { $input = $request->all(); $user = $this->userRepository->create($input); Flash::success('User saved successfully.'); return redirect(route('user.index.'.$input['year'])); } There is exist error like this : InvalidArgumentException in UrlGenerator.php line 314: Route [users.index.2016] not defined. When error, the url look like this : http://localhost/mysystem/public/users My routes\web.php is like this :