laravel

Laravel5.8 Pusher not working. Cannot receive

蓝咒 提交于 2021-02-10 14:21:51
问题 I am creating realtime chat app. I have set up pusher in my laravel and vue.js project. But it doesn't work. Though I don't have any error in the console. Also, I have no error in network tab. I need to create messenger app, so I need a realtime chat function. Now, I can push user's comment but in the other user's window, nothing shows up. But it does, once I refresh the page. I think my pusher setting has something wrong, because in the pusher debug console, any session is not executed. Here

laravel like query is not working?

依然范特西╮ 提交于 2021-02-10 14:21:13
问题 This is my code : $lists = DB::table('connection_request as cr') ->leftJoin('users as u', function($join) { $join->on('u.id', '=', 'cr.sender_id')->orOn('u.id','=', 'cr.receiver_id'); }) ->select('cr.id as connection_id','cr.sender_id as sen_id','cr.receiver_id as rec_id','cr.approve_status','u.id','u.user_type','u.user_type_id',DB::raw("IF(u.avatar = '', 'uploads/avatar/default.jpg', u.avatar) as avatar"),'u.name','u.email') ->where(function($query) use ($user_id) { if(!empty($user_id)):

Composer update ended up saying Trait 'Carbon\Traits\Mixin' not found

眉间皱痕 提交于 2021-02-10 14:14:31
问题 I installed a new XAMPP with a higher version of PHP (7.2.21) on my windows machine and moved my Laravel project there. When I ran composer update in my project root everything went well but at the end it gave the following: Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi In Macro.php line 33: Trait 'Carbon\Traits\Mixin' not found PHP Fatal error: Trait 'Carbon\Traits\Mixin' not found in D:\xampp\htdocs

How to get selected row values from a dynamic html table using JQuery?

浪尽此生 提交于 2021-02-10 12:58:08
问题 I have a html table dynamically populated from a database using laravel framework. I have put a checkbox in the row header and a Save Entry button. I want to get only the checked row values of the table including the footer of the table which indicate the calculation summary. something like this: arrbreakdown = []; //push here the checked row values. arrsummary = []; //push here the calculation summary. Reproducible example: <table class="table table-bordered" id="purchasetable"> <thead> <tr>

How to get selected row values from a dynamic html table using JQuery?

独自空忆成欢 提交于 2021-02-10 12:58:02
问题 I have a html table dynamically populated from a database using laravel framework. I have put a checkbox in the row header and a Save Entry button. I want to get only the checked row values of the table including the footer of the table which indicate the calculation summary. something like this: arrbreakdown = []; //push here the checked row values. arrsummary = []; //push here the calculation summary. Reproducible example: <table class="table table-bordered" id="purchasetable"> <thead> <tr>

laravel adminlte css path not working

十年热恋 提交于 2021-02-10 12:56:49
问题 i am beginner in laravel , im doing my project. but admin lte css path not working.. i had tried many time. but no lock.. enter image description here i create a folder css on project root folder. i put all css and js file in it. enter image description here <link rel="stylesheet" href="{{ URL::asset('/css/dist/AdminLTE.min.css') }}"> <!-- iCheck --> <link rel="stylesheet" href="plugins/iCheck/square/blue.css"> <link rel="stylesheet" href="{{ URL::asset('css/plugins/iCheck/square/blue.css') }

Check if token expired in Laravel

蓝咒 提交于 2021-02-10 12:54:31
问题 I have table tokens with columns: user_id , token , expires_at . Example: I have token: 12345, for me, and he expires at: 2018-06-05 When I generate new token, I generate up to 7 days.. How I can check this in model? I tryied do with scope in model: public function scopeExpired($query) { return $this->where('expires_at', '<=', Carbon::now())->exists(); } But not working. Always false.. 回答1: I've always done stuff like this the following way. Note that you need the expires_at field as an

Sorting a Laravel Collection by Many to Many Pivot Table Column

时光怂恿深爱的人放手 提交于 2021-02-10 12:45:03
问题 I'm looking at displaying a list of asset s belonging to a product in an order defined by order_column on the pivot table product_asset . In this case, the sortBy function has no effect. No errors are thrown, but it returns the collection array in the same order no matter what. Here's what I have laid out currently: Database: Schema::create('product_asset', function (Blueprint $table) { $table->integer('product_id')->unsigned()->index(); $table->foreign('product_id')->references('id')->on(

Converting an array of arrays from Laravel's collection into an object with an array in json

空扰寡人 提交于 2021-02-10 12:07:58
问题 I am generating an an array of categories and subcategories in my Laravel API for use in my client side app. I'm doing this by using the collection's filter and map methods to organize the data pulled from the database: // get the data from the category table $categoryData = $categories->all()->categories(); // filter the data by category names we know we want and create the multi-dimensional array of the fields we need $categoryList = $categoryData->filter(function ($value) { return $value[

Converting an array of arrays from Laravel's collection into an object with an array in json

眉间皱痕 提交于 2021-02-10 12:07:55
问题 I am generating an an array of categories and subcategories in my Laravel API for use in my client side app. I'm doing this by using the collection's filter and map methods to organize the data pulled from the database: // get the data from the category table $categoryData = $categories->all()->categories(); // filter the data by category names we know we want and create the multi-dimensional array of the fields we need $categoryList = $categoryData->filter(function ($value) { return $value[