laravel-5.5

Laravel - Include assets on Middleware Auth

会有一股神秘感。 提交于 2021-02-18 11:47:46
问题 Inside my app, exist a route group called admin , any route inside this group call two resources: public/css/admin.css and public/js/admin.js , but any unauthenticated user has access to these files. How can I include these files inside the Auth Middleware? My admin routes: Route::group(['prefix' => 'admin', 'middleware' => ['auth']], function () { Route::get('/', 'Admin\IndexController@index')->name('panel'); Route::group(['prefix' => 'users'], function() {}); Route::group(['prefix' =>

Convert json String into Object of custom class instead of stdClass.

大憨熊 提交于 2021-02-10 16:18:42
问题 my order.php file has /** * Encode the cart items from json to object * @param $value * @return mixed */ public function getCartItemsAttribute($value){ return json_decode($value); } And in my controller i fetch cartItems as follows public function orderDetails(Order $order){ $address = implode(',',array_slice((array)$order->address,2,4)); foreach ($order->cartItems as $item){ dd($item); } return view('/admin/pages/productOrders/orderDetails',compact('order','address')); } And in above code dd

Convert json String into Object of custom class instead of stdClass.

心已入冬 提交于 2021-02-10 16:16:12
问题 my order.php file has /** * Encode the cart items from json to object * @param $value * @return mixed */ public function getCartItemsAttribute($value){ return json_decode($value); } And in my controller i fetch cartItems as follows public function orderDetails(Order $order){ $address = implode(',',array_slice((array)$order->address,2,4)); foreach ($order->cartItems as $item){ dd($item); } return view('/admin/pages/productOrders/orderDetails',compact('order','address')); } And in above code dd

How can Angular 4 use with Laravel 5.5 together?

徘徊边缘 提交于 2021-02-10 14:14:40
问题 I know that angular can integrate with some frameworks. I want to use angular version 4 into Laravel version 5.5 but I don't know how to setup the application. It is possible that I install angular CLI into Laravel project? Which solutions is the best for building app with angular ( integrate with framework or separate two projects)? 回答1: I am assuming you have the understanding about Angular and Laravel. I have used Angular(2+) and Laravel in many projects. Angular is for front-end

Having 2 forms on the same page in Laravel?

心已入冬 提交于 2021-02-10 07:12:19
问题 I'm trying to tackle a "two forms on one page" issue with my PHP code, but its turning out to be more tirkcy than I expected, and just isn't behaving in the correct way as I thought it would. For the first form (Login) I'm using this if statement to determine if the message if for the Login. @if(Session::has('message') && Session::get('last_message_for') == 'login') <div class="notification is-{{ Session::get('color') }}"> <i class="fa fa-times"></i>   {{ Session::get('message') }} </div>

Having 2 forms on the same page in Laravel?

陌路散爱 提交于 2021-02-10 07:06:12
问题 I'm trying to tackle a "two forms on one page" issue with my PHP code, but its turning out to be more tirkcy than I expected, and just isn't behaving in the correct way as I thought it would. For the first form (Login) I'm using this if statement to determine if the message if for the Login. @if(Session::has('message') && Session::get('last_message_for') == 'login') <div class="notification is-{{ Session::get('color') }}"> <i class="fa fa-times"></i>   {{ Session::get('message') }} </div>

Laravel Notifications Listener Is Useless When Implementing the Queue

落花浮王杯 提交于 2021-02-07 09:35:34
问题 Laravel Version: 5.5.* PHP Version: 7.1.* According to the docs https://laravel.com/docs/5.5/notifications it should be super simple to subscribe to Notification events. I've followed the steps in the docs, but my Notifications implement ShouldQueue and they weren't properly populating the event listener. I'm wonder if the issue seems to be in the framework code . Notice that in the framework github (linked right above), that new Events\NotificationSent($notifiable, $notification, $channel,

Laravel Notifications Listener Is Useless When Implementing the Queue

心已入冬 提交于 2021-02-07 09:32:09
问题 Laravel Version: 5.5.* PHP Version: 7.1.* According to the docs https://laravel.com/docs/5.5/notifications it should be super simple to subscribe to Notification events. I've followed the steps in the docs, but my Notifications implement ShouldQueue and they weren't properly populating the event listener. I'm wonder if the issue seems to be in the framework code . Notice that in the framework github (linked right above), that new Events\NotificationSent($notifiable, $notification, $channel,

Is there some sort of Laravel Controller cache?

与世无争的帅哥 提交于 2021-02-07 06:48:19
问题 Weird problem I'm having with Laravel 5.5 I can update and even delete a controller and yet it appears as if a cached / old version is still being called. I've tried clearing cache, clearing route cache, clearing config cache - doesn't seem to have any effect. On my local test environment if I delete the controller file then try to access it I immediately get a not found error. On my production server I do not. Anyone have any ideas or advice? 回答1: You can try running: php artisan clear

Laravel 5.5 Consolidate migrations w/ production database

廉价感情. 提交于 2021-02-06 11:05:08
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.