laravel-5.3

How to config mail.php for zimbra mail server in Laravel 5.3?

好久不见. 提交于 2019-12-08 07:59:58
问题 I create VPS and install zimbra mail in mail.mywebsite.com and mywebsite.com is in other VPS. My mail.php in config folder: 'driver' => 'smtp', 'host' => 'mail.mywebsite.com', 'from' => [ 'address' => 'customers@mywebsite.com', 'name' => 'mywebsite.com' ], 'encryption' => env('MAIL_ENCRYPTION', 'No Encryption'), 'username' => 'info@mywebsite.com', 'password' => '*******', 'sendmail' => '/usr/sbin/sendmail -bs', In .env file: MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME

How to remove quotes from SQL query Laravel?

帅比萌擦擦* 提交于 2019-12-08 07:07:16
问题 I have the following query: $this->data = \DB::table('months')->select(DB::raw("months.id, COUNT(transactions.id) as total")) ->leftJoin('transactions', function($join) { $join->on('months.id', '=', DB::raw('MONTH(created_at)')) ->on('transactions.doctor_id', '=', $this->user_id); }) ->groupBy('months.id') ->get(); It involks an error on line ->on('transactions.doctor_id', '=', $this->user_id); . It added single quotes for variable $this->user_id . How to avoid this eroros: SQLSTATE[42S22]:

Auth::attempt() is not working in Laravel 5.5

南笙酒味 提交于 2019-12-08 01:22:38
问题 My registration form is working and it store users to db but when user login then Auth::attempt() return false. Here is my code for login. I store the password in db in sha1 encription. Route::post('login',function(){ $creds=array( 'email' => Input::get('email'), 'password' => sha1(Input::get('password')) ); $auth = Auth::attempt($creds); dd($auth); 回答1: Even though you can implement a Service provider as describe in this post, You can do it manually by with using other auth method This means

If the second page has one item, the pagination is not displayed in laravel 5.3

我的未来我决定 提交于 2019-12-07 22:30:16
问题 let's assume we have 11 items and we set 10 items per page so the second page will have 1 item, in this case the pagination in second page is not displayed but when add another item and the list becomes 12 and the second page has 2 items the pagination is displayed. Controller: $cities = City::orderBy('id', 'desc')->paginate(10); return view('cities.home', compact('cities')); View: <div class="panel-body"> <div class="table-responsive panel panel-sky"> <table class="table table-striped table

InvalidArgumentException Please provide a valid cache path Error laravel 5.2

。_饼干妹妹 提交于 2019-12-07 17:49:27
I'm working with Laravel 5.2 and i have an error when i run composer update or artisan optimize .. i've searched on my vendor, i didn't found compiled.php file ! i try to generate this i run the artisan optimize, i have the same error [InvalidArgumentException] Please provide a valid cache path Script php artisan clear-compiled handling the post-update-cmd event returned with error code 1 how i can resolve this ? Please Try it: create these folders under storage/framework : sessions views cache And also you can use this command to install: sudo composer install Its will be working. 来源: https:/

Laravel Echo cannot subscribe to Pusher private channel

霸气de小男生 提交于 2019-12-07 17:09:14
问题 I am not able to listen to an event in a private channel. However, I can listen to public channel. The problem This works: Echo.channel('Foo.Bar') .listen('MyEvent', (e) => { console.log('It worked!'); }); I can see in Pusher Debug Console that there are three consecutive events: CONNECTION SUBSCRIBED OCCUPIED Plus, if I send Channel: Foo.Bar; Event: App\Events\MyEvent , I can see the output in my browser console. However, this doesn't work: Echo.private('Foo.Bar') .listen('MyEvent', (e) => {

Passport Laravel Rest API Auth With Normal Design

落爺英雄遲暮 提交于 2019-12-07 11:48:00
问题 I have Completely assigned the Passport REST API and i get token and tested on PostMan and it retrieve the data with this Auth this is normal js html with laravel blade view (NOT VUE.JS) <script> $.ajax({ method: 'POST', dataType: 'json', url: "**********/api/User/GetPost", headers: { 'Authorization':'Bearer Tokenblablabla', 'Content-Type':'application/json' }, data: null, success: function(data){ console.log('succes: '+data); } }); this is the controller function public function GetPosts

Multiple auth for laravel

南楼画角 提交于 2019-12-07 10:23:06
问题 I want to split middleware auth to two role one is for admin and second for user but some route is use for all user and admin and few route is for admin only how can i split with route? Auth::routes(); Route::group(['middleware' => 'auth'], function () { //Some route here }); Route::group(['middleware' => ['guest']], function () { //some route here }); 回答1: Here is my implementation for access control for admin and users(agents in my case) I have a boolean field in my user table ( is_admin )

Missing argument 1 for Illuminate\Support\MessageBag::has()

一世执手 提交于 2019-12-07 08:29:09
问题 When i access my Laravel Project. It Returns Following Errors. How to Solve It. Missing argument 1 for Illuminate\Support\MessageBag::has(), called in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php on line 92 and defined (View: /var/www/laravel/resources/views/welcome.blade.php) In my Blade Code : @if ($errors->has()) <div class="alert alert-danger"> @foreach ($errors->all() as $error) {{ $error }}<br> @endforeach </div> @endif 回答1: Check this line: @if (

Laravel Carbon localization not working (get localized name of month from number)

流过昼夜 提交于 2019-12-07 07:04:55
问题 Using Laravel 5.3, In my method I use setlocale(LC_TIME, 'hr-HR'); dd(Carbon::now()->formatLocalized('%A')); but I get Sunday instead of CroatianWordForSunday . I tried using Carbon::setLocale('hr') instead setlocale() but I still get Sunday . In my config/app.php file I have set 'locale' => 'hr' . Thing to note is that Carbon's diffForHumans() method is successfully translated if I use Carbon::setLocale('hr') . In the end all I'm trying to do is convert number 8 to August but in Croatian. I