laravel-5.2

Laravel - Repeating entry with unique parameter for different users

我的梦境 提交于 2019-12-24 11:55:58
问题 Using Laravel 5.2. I'm developing a Phonebook project in Laravel, where you store contact info in a table named Contacts . To create new contacts in this table, you have to be registered, and your info will be recorded in a users table I created a view to show the Contacts table and in the Controller I came up with a logic to only show the contacts that you created in the table. So, it means you cannot see the contacts another user created in the table. This logic is to prevent the user

Issue with Laravel orderby

[亡魂溺海] 提交于 2019-12-24 10:14:15
问题 I am trying to order my products by price once the client click order by inside the product page. I keep getting the next error: Undefined index: title (View: C:\xampp\htdocs\eshop\resources\views\content\item.blade.php) . My 'item.blade.php' is the page that shows the larger size of the product in separate page. I think the issue is inside my controller Item function or im my model getItem function , I might be wrong... would appreciate if you could help me out .Thanks My Route : Route::get(

How to use conditional for this query in Laravel 5.2

落花浮王杯 提交于 2019-12-24 09:58:02
问题 Here is the scenario Table: Users id | name | grade | subject ---- | ------|--------|------ 1 | Mark | a | science 2 | Earl | a | english 3 | John | c | english 4 | Mike | d | science 5 | Matt | e | english What I want to do is populate the grades that are non-repeating or non-duplicate grades but for english subject only So it should just show c e I've got this far controller: $grades = user::select('grade', DB::raw('COUNT(grade) as gradecount')) ->where('subject', 'english') ->groupBy(

Laravel 5.3 blank white screen no errors

你说的曾经没有我的故事 提交于 2019-12-24 09:16:10
问题 I have gone through so many forums trying to find a solution to fix this error but non seems to be working. Error in site-error.log Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /path/site/vendor/laravel/framework/src/Illuminate/Foundatio‌​n/helpers.php on line 475 I have assigned sudo chown -R www-data:www-data /path/directory results for ls -al drwxrwxrwx 12 www-data www-data 4096 Oct 25 10:06 . drwxrwxrwx 6 www-data www-data 4096 Oct 25 06:46 .. drwxr

Wrong COM_STMT_PREPARE response size. Received 7. LARAVEL ERROR

◇◆丶佛笑我妖孽 提交于 2019-12-24 08:16:03
问题 I have a blog that is developed using laravel. In my local PC, everything is okay. But when I upload it in live shared hosting server it throws error like below: ErrorException in MySqlConnector.php line 124: Wrong COM_STMT_PREPARE response size. Received 7 My server configuration is given below Server: MariaDB Server version: 10.1.20-MariaDB - MariaDB Server PHP 5.6 I could not find any solution. Any help would be greatly appreciated. 回答1: I also faced the same problem. My web host provider

Why MongoDB Class doesn't work in Laravel?

若如初见. 提交于 2019-12-24 07:59:56
问题 I want to use MongoDB in Laravel, This is my code in Controller : public function create (Request $request) { $m = new MongoClient(); $db = $m->selectDB("Laravel"); $collection = $db->selectCollection("Posts"); $document = array( "Title" => $request->input('Title'), "Publisher" => $request->input('Publisher') ); $collection->insert($document); } But when I click "Submit", It gives me an error : Fatal error: Class 'App\Http\Controllers\MongoClient' not found I have run MongoDB Server & also

How to extend Illuminate\Routing\Route in laravel?

眉间皱痕 提交于 2019-12-24 07:59:39
问题 I want extend Illuminate\Routing\Route and use it in this way: request()->someCustomFunction(); any suggests ? 回答1: You can write your own class that extends Illuminate\Routing\Route and the n in your service provider you can bind it like this: public function register() { $this->app->bind('Illuminate\Routing\Route', 'YourClassThanExtendsRoute'); } This should works. 回答2: The solution is more a hack since Laravel 5 where it became more difficult to extend the default router. All you need is

How to include a blade template in different directory?

你。 提交于 2019-12-24 07:15:57
问题 I was already trying to follow the documentation tutorial. But, I always get an error, and I don't know how to solve it How can I include a blade template in a different directory? Dashboard.blade.php = in folder views/admin Landingpage.blade.php = in folder views/admin/subpage 回答1: The @include directive allows you to include a Blade view from within another view. //resources/views/admin/dashboard.blade.php @include('admin.dashboard') //resources/views/admin/subpage/landingpage.blade.php

Laravel 5.2 stream download

十年热恋 提交于 2019-12-24 06:38:46
问题 I'm getting a bit muddled with a CSV download. I'm very happy to save it to a file and supply a link to the user, but this seems like the wrong way to go judging from things like these. Going from this answer Use Laravel to Download table as CSV I think I've found that the stream() method no longer exists. public function download() { $headers = [ 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0' , 'Content-type' => 'text/csv' , 'Content-Disposition' => 'attachment; filename

Laravel - Foreach loop - Show a specific message for types of result

£可爱£侵袭症+ 提交于 2019-12-24 05:52:46
问题 So I have a messages table with all messages. I want pinned messages to be at top and normal ones to follow after. I have been able to do this normally with the orderBy() method in my query. However, I want to display some specific messages for all my pinned messages. I would like to have a header at the top of the pinned messages and a header at the top of the normal messages to let users know that pinned and normal messages are there. Example: My query: $rows = Messages::where('active',