laravel-5.3

Laravel 5.3 - htmlspecialchars() expects parameter 1 to be string

本小妞迷上赌 提交于 2019-11-27 15:07:08
I am new to laravel and I am enjoying it. While working on a social media project I got this error: htmlspecialchars() expects parameter 1 to be string, object given (View: C:\wamp64\www\histoirevraie\resources\views\user\profile.blade.php) I have checked some questions on this site but I have not found a question that solves my problem. this is what my profile.blade.php is made of: <ul class="profile-rows"> <li> <span class="the-label">Last visit: </span> <span class="the-value mark green">{{ \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $user->lastVisit)->diffForHumans(\Carbon\Carbon::now(

cURL error 60: SSL certificate in Laravel 5.4

南楼画角 提交于 2019-11-27 13:59:01
问题 Full Error RequestException in CurlFactory.php line 187: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) Scenario Before anyone points me to these two laracasts answers: https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to

Laravel 5.4, 5.3 : customize or extend notifications - database model

本秂侑毒 提交于 2019-11-27 09:41:52
IMHO, the current Database channel for saving notifications in Laravel is really bad design: You can't use foreign key cascades on items for cleaning up notifications of a deleted item for example Searching custom attributes in the data column (casted to Array) is not optimal How would you go about extending the DatabaseNotification Model in vendor package? I would like to add columns event_id , question_id , user_id (the user that created the notification) etc... to the default laravel notifications table How do you override the send function to include more columns? In: vendor/laravel

How can I display modal in modal on vue component?

白昼怎懂夜的黑 提交于 2019-11-27 08:59:09
问题 My view blade like this : <a href="javascript:" class="btn btn-block btn-success" @click="modalShow('modal-data')"> Click here </a> <data-modal id="modal-data"></data-modal> If the button clicked, it will call dataModal component (In the form of modal) dataModal component like this : <template> <div class="modal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <!-- modal content data --> <div class="modal-content modal-content-data"> <form id="form"> <div class="modal

How to get average of column values in laravel

别说谁变了你拦得住时间么 提交于 2019-11-27 07:42:12
问题 Lets say I have this column star ---- 1 3 3 1 2 5 3 It has seven rows and there are integer values! I want to have it added and divided by the rows there are. How do I do it in laravel. I can do it in plain php but I want to learn it in laravel. 回答1: Try this : $avgStar = Model::avg('star'); " Model " will replace with your model name 回答2: If you want to do it with the query builder you can use aggregate methods like avg : $avg_stars = DB::table('your_table') ->avg('star'); Laravel 5 docs

Laravel's 5.3 passport and api routes

為{幸葍}努か 提交于 2019-11-27 06:55:57
I'm using Laravel Framework version 5.3.9, fresh download nothing added on via composer(except "laravel/passport": "^1.0" ). I did all the things suggested in the docs . Tables are created, routes are up, everything works fine. However I need passport for an API. My routes look like so: +--------+----------+-----------------------------------------+----------------------+----------------------------------------------------------------------------+------------+ | Domain | Method | URI | Name | Action | Middleware | +--------+----------+-----------------------------------------+-----------------

Laravel 5.3 multiple file uploads

痴心易碎 提交于 2019-11-27 06:44:31
问题 How can I upload multiple files in Laravel 5.3 . If I try it with 1 image it works but multiple images are not uploaded. This is my code: if($request->hasFile('attachment')) { foreach ($request->allFiles('attachments') as $file) { $file->store('users/' . $user->id . '/messages'); } } 回答1: It works now like this: $files = $request->file('attachment'); if($request->hasFile('attachment')) { foreach ($files as $file) { $file->store('users/' . $this->user->id . '/messages'); } } I had to append []

What is the use of strict in laravel config/database?

♀尐吖头ヾ 提交于 2019-11-27 06:39:22
问题 I am new on laravel & today I have to turn off the strict in config/database file as I need to use group by in my SQL query. What is the use of strict in laravel config/database and by turning it off or strict = false will it affect the website? Will it make our website security weak? what is the disadvantage of turning strict off in laravel config/database Thank You in advance? :) 回答1: According to the doc: Strict mode controls how MySQL handles invalid or missing values in data-change

laravel 5.3 new Auth::routes()

房东的猫 提交于 2019-11-27 04:58:41
问题 Recently I start to use laravel 5.3 to write a blog, but I have a question after run php artisan make:auth when I run this, it will generate routes in my web.php this is the code in it: Auth::routes(); Route::get('/home', 'HomeController@index'); Then I run php artisan route:list , I find lots of actions, like LoginController@login... But I didn't find these actions in my App\Http\Controllers\Auth , where are these? And also what is the Auth::routes() stand for, I can't find the routes about

How to solve Missing argument 1 for App\Repositories\FavoriteRepository::delete() ? (Laravel 5.3)

爷,独闯天下 提交于 2019-11-27 04:55:26
问题 My service is like this : public function delete($store_id) { $result = $this->favorite_repository->delete($store_id); dd($result); } My repository is like this : public function delete($store_id) { $data = self::where('favoritable_id', $store_id)->delete(); return $data; } There exist error : Missing argument 1 for App\Repositories\FavoriteRepository::delete(), called in C:\xampp\htdocs\mysystem\app\Repositories\FavoriteRepository.php on line 45 and defined Can you help me? UPDATE The delete