Member Since 2 Years Ago
Vancouver
4,760 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Replied to The Php Artisan Is Super Slow In Just One Projects
Are all of your projects running on the same system, talking to the same database, using the same php instance?
Replied to For Loop And Modal
Your script is built after the for each loop runs so the value in your variables that are used in creating the script is from the last record.
Render your code and then pull up the resultant html and java code it will be apparent then.
Replied to Advice Please
Hi James could you provide a detailed example of what you are trying to accomplish? Are only the field labels variable or are you varying the number of fields and/or purpose/data type in these fields?
Replied to Generate Pages Dynamically
If you know ahead of time that you will have lets say 20 forms you could have a base form and then based on some logic include one of the 20 unique forms as an include.
The format of the include statement is similar to
@include('admin.projects.formblock1',['table' => $project, 'key' => 'project'])
or
@include('admin.projects.formblock2',['table' => $project, 'key' => 'project'])
Replied to Generate Pages Dynamically
Do you have a fixed number of forms (18, 30, 40 etc) such that you could build the blade html for each individually or are you building a system where users can create new forms and somehow layout the fields and field positioning?
Started a new Conversation Adldad2-laravel On Development PC
Hi smart people, I'm working on ldap authentication using the Adldap2-laravel package. I currently have the package installed and working correctly on my testing server but I'm having trouble getting the code with the same configuration values working on my WindowZ10 PC.
The Ldap server that I'm connecting to is running on MS Azure.
I'm running into Can't contact LDAP server error messages.
Thinking that perhaps it was a AV, Firewall or Azure issue I found and can run a simple windows ldap client on my PC that when using the account, domain and password from my .env file works.
I have fought with this for several days. The only significant differences between my development and test server is
development WindowZ10 APP_URL=http://localhost:8000
test Ubuntu APP_URL=https://real_public_domain_name.com (url changed for security purposes)
Could it be a http vs https or the fact that my development PC does not have a real DNS name?
Ideas?
Replied to Loop Not Working
Your variable $time will be an object. If you do a
dd($time);
You should see that it's an object rather than just a field and as you are using it as your key in your array this is not a happy happy moment.
Replied to Laravel Blade View
I just found the following that may help:
-3
Nested tables need to actually be nested within <td> elements which in turn are nested within <tr>'s and other tables, not just within the tables or rows directly.
MDN Reference
<table> Permitted Content:
an optional <caption> element,
zero or more <colgroup> elements,
an optional <thead> element,
either one of the following:
zero or more <tbody> elements
one or more <tr> elements
an optional <tfoot> element
<tr> Permitted Content:
Zero or more <td> and/or <th> elements; script-supporting elements (<script> and <template>) are also allowed
<td> Permitted Content:
Flow content. (<table> is included in this list)
Replied to Laravel Blade View
I don't know if the markup supports a table within a table. Can you try to comment out the inside table to see what generates?
Try commenting out or removing the following
@if ($student['subjects'])
<table class="table table-sm table-dark collapse row{{ $student['id'] }}">
<thead>
<tr>
<th scope="col">subject.Id</th>
..............
</tr>
</thead>
<tbody>
@foreach($student['subjects'] as $subject)
<tr>
<td>{{$subject['id']}}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
Awarded Best Reply on Adldap2-laravel Sync_attributes
Well...... if you actually upload your changed code to the server that you are testing on it works...
Sorry people, stupid programmer tricks...
Replied to Adldap2-laravel Sync_attributes
Well...... if you actually upload your changed code to the server that you are testing on it works...
Sorry people, stupid programmer tricks...
Started a new Conversation Adldap2-laravel Sync_attributes
Hi does anyone have experience with Ldap synchronization and specifically the Adldap2-laravel package? I now have the ldap login working correctly and it synchronizes the user name and password correctly from ldap back to the user model.
I have several other fields in the user model that I would like updated as well and I read that in the ldap_auth.php file in the sync_attributes method that you can either list a series of key pairs to update or can list a handler class.
I have set up:
'sync_attributes' => [
App\Handlers\LdapAttributeHandler::class,
],
but my logic in the handler class never runs.
Any ideas?
Replied to Eloquent Query Relations
I'm not sure what your { and } are doing to your query?
"%{$keyword}%"
my code uses
"%$keyword%"
Replied to Route List Not The Same As Web.php
I once had a similar issue but I found that I had syntax error in my web.php file.
Replied to Model With Many Attributes: One Or Multiple Models?
I would personally create 4 models.
Article would have all of the common data and they for the unique attributes the other three models would be used.
Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries
I'm assuming that your flight model already has an eloquent relation called 'aircraft', if this is true then yes.
Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries
Sorry this logic would go in your controller and not in the model. I was trying to guess the controller logic that you may be using.
Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries
In the typical N+1 discussion its expected that you add the 'with' clause to your main query.
Example something like:
Flights = 'App\Flight'::where('criteria', '=', x)
-> with(['aircraft' => function($query){ $query->where('arrival_time',null);}])->get();
I may have some misplaced punctuation here.
Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries
I suspect that it is and therefor you hitting the N+1 senario. For a moment change your code to return a hard coded or DB table value to see if the DB reads go away.
Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries
Can you share the code in your model?
Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class
Can you try?
@extends('layout.app')
@section('content')
<div class="row">
<div class="col-12 text-center">
<h2> Page caption</h2>
</div>
</div
<div class ="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
</div>
@endsection
Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class
Can you repost your blade file now that you have made the changes?
Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class
Try ending the row immediately after your 12 column caption and then create a new row below it for your cards.
Replied to Managing DB Schema Changes On A Production Database
I use a github repository along with Forge to manage my production site. With Forge when you run a deployment from their UI it pulls the most recent copy from my github account and automatically runs a migration.
It's just like magic. :)
Replied to Using AND/OR Operators Together In Controller
I think you were on the right track as I have similar code in one of my projects to bracket the ands & ors.
Below I have reformatted your code a bit (to make it easier for me to read) and to pull the get() statement out of the second query. I have not tested to see that this is syntactically correct but when you have a chance please try this.
$single_contact_add = Datainfo::where(function ($query)
{ $query->where('uploaded_by', '=', Auth::user()->id)
->orWhereIn('uploaded_by', '=', Auth::user()->getchild(Auth::user()->id));
})
->where(function ($query)
{ $query->where('id', '!=', $group_contacts)
->orderBy('id', 'DESC');
})
->get();
Replied to 3 Tier Architecture
Normally the Presentation tier is the load balancer. Even if your client wishes to internally host I still recommend the series as it discusses all of the basics in setting up a multi-tier Laravel application.
Replied to 3 Tier Architecture
Hi Zacky this type of configuration usually results in a load balancer -> one or more app servers -> one or more db servers.
If you would like to view a video series that walks you through the steps there is one here on laracasts : https://laracasts.com/series/learn-laravel-forge
Replied to Strange Password In My Database
Is there any chance that the user in question might have two accounts, one with a hashed pwd and then this one?
Replied to Strange Password In My Database
I would suggest that this password was not updated via your Registration Controller as it would be hashed like the others. I think you likely have a security issue where someone has write access to your database either through some form of SQL injection, application bug or directly from another DB management tool.
Replied to Blade Indent/autocomplete Plugin Is Not So Good In Phpstorm
I would like to find a solution to this as well.
Replied to Dropped Queries By ~29,980 But Still 30+ Seconds To Load...
I assume that your queries are running against tables with significant number of records in them. Are you filtering the data with where statements and if so do you have indexes on the fields being queried?
Replied to After Copying A Laravel Project Blade Views Not Reflecting Changes
Perhaps your domain name/ server instance is not pointing to the code base that you think it is?
Replied to CSS Not Working !
Using the same tool if you you select any element and explore the attached sytles what do you see? If you are not seeing an error I would then think that your css styles are being overriden?
Also using the developer tool you should be able to explore your html document and in the header where you see your stylesheet being applied it should be a link where you can click on it and see that you in fact do have content in your attached stylesheet.
The most common issues are:
Replied to CSS Not Working !
If you use Google Chrome and visit > More tools > Developer tools do you see any errors in the console tab?
Replied to Query Efficiency
With Eloquent queries there is a concept called Eager Loading where in the Eloquent query you specify which other records to load using a 'with' statement. I recommend that you read up on this.
https://laravel.com/docs/5.8/eloquent-relationships#eager-loading
Replied to Forge Down?
I understand that this is being addressed now: https://twitter.com/themsaid/status/1172166429648543744
Replied to FORGE IS DOWN
I understand that this is being addressed now: https://twitter.com/themsaid/status/1172166429648543744
Replied to User Specific Alerts With Many Filters
Lets call the data that people are uploading Opportunites.
I would look to create your system like this.
Let people upload Opportunities and as they are uploaded you set a flag on their record saying not processed.
On a timer, lets say once per hour you kick off a job that walks through all of your users and for each of them you run a routine that compares their filters against the new Opportunities and sends notifications as needed. Once done all of the Opportunities you just processed are flagged as complete.
As new Users join your system you set a flag on their saying not processed.
On a timer, lets say once per day you kick off a job that walks through the new users and for each of them you run a routine that compares their filters against ALL Opportunities and sends them notifications as needed.
For the 'flag' on Opportunities and Users I would use an numeric integer batch number that you increment just before kicking off your long running jobs such that you don't have a new Opportunity or User created while your job is running that is accidentally skipped.
Replied to Laravel Datatables Search Error
Is this a production machine or are you testing this via 'php artisan serve' server?
Replied to Updating Database On JQuery.ajax Call
Something like:
foreach ($pages as $page) {
foreach($page->children as $children) {
// your update logic here
// start with a dd($page,$children) to dump the values returned to your controller
}
}
Replied to Using Related Model True/false Functions In Eloquent Queries
The definition of the Accessor requires specific naming structure.
In your case it would be GetLatestassignmentAttribute the Get and Attribute portion of the naming performs some Larvel magic.
Defining An Accessor To define an accessor, create a getFooAttribute method on your model where Foo is the "studly" cased name of the column you wish to access. In this example, we'll define an accessor for the first_name attribute. The accessor will automatically be called by Eloquent when attempting to retrieve the value of the first_name attribute:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* Get the user's first name.
*
* @param string $value
* @return string
*/
public function getFirstNameAttribute($value)
{
return ucfirst($value);
}
}
Replied to Using Related Model True/false Functions In Eloquent Queries
Typically you would use an Accessor for this type of dynamic field generation.
Have you reviewed: https://laravel.com/docs/5.8/eloquent-mutators
Replied to Percentage Difference Between Dates
Basically you would need at least three dates to create a percentage as a percentage is a ratio.
As an example you if you wanted to know today as a percentage of days in the month. You would need the start date, end date and today's date.
Aug 1 -> Aug 30 is 30 days Aug 1 ->Aug 6 is 6 days
Your percentage comes as 6/30 = .2 or 20%
Date calculation example https://laracasts.com/discuss/channels/general-discussion/difference-between-two-carbon-dates
Started a new Conversation Forge Branch
Hi I have both a production site and testing site maintained via Forge. Until today both production and testing were set up to use my Master branch which was based on Laravel 5.7. I want to move to Laravel 5.8 so I created a branch (called Upgrade-to-5.8) and with my IDE worked through the various issues.
I now have both Master and Upgrade-to-5.8 branches available on Github.
In Forge I accessed my test server site and changed the Deployment Branch from Master to Upgrade-to-5.8 and ran Deploy Now. Below is a portion of the deployment log where it appears that the master branch was deployed rather than my Upgrade-to-5.8 branch.
Is there something else that I need to do to change my branch on this site?
Wed Aug 28 21:12:57 UTC 2019
From github.com:XXXXXX(Changed for security purposes)
* branch master -> FETCH_HEAD
Already up to date.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
Replied to How To Sync Attributes In A Specific Order ?
On my pivot tables I always add an id field and make it the primary index just like every other table used within Laravel. This would provide you with a method to sequence your records if you managed the sequence when they are created via the previously described ->attach method.
Replied to Tips For Seeding Production Tables From Devel Environment
That is a great idea thank you!