3,640 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.
Earned once your experience points ranks in the top 10 of all Laracasts users.
Replied to Correct Syntax
You'll need to look at this area on the docs for creating invoices: https://stripe.com/docs/api/invoices/create?lang=php
Replied to Rotate Image Before Upload With Livewire
I got this working, this was the solution :)
public function rotate($degrees) {
$source = Image::make($this->newSig->getRealPath());
$source->rotate($degrees)->save();
$source->stream();
}
Started a new Conversation Rotate Image Before Upload With Livewire
Hi,
I'm looking to try build the functionality to rotate an image with its temporaryUrl prior to saving it permanently with livewire.
Currently I am displaying the image with its temporaryUrl before saving it permanently to S3 however I need to allow the user to adjust its rotation before the final save.
I was previously using this when I was not using livewire however it doesn't seem to be working with the temporary files http://image.intervention.io/
Anyone done this before or know of an easy way to achieve this?
Replied to Request Array Has A Max Limit If 119?
Thanks for this information, just add the additional information and how i got this work was to increase the PHP max_input_vars
variable to the desired amount and this would then work.
Replied to Request Array Has A Max Limit If 119?
I have updated the original post.
Never made this myself it was handed to me from a previous developer
Started a new Conversation Request Array Has A Max Limit If 119?
Hi,
Basically I have a form with a large table on a page which has 169 rows on there.
Illuminate\Database\Eloquent\Collection {#1530 ▼
#items: array:169 [▶]
}
Now when i go to submit the form to update the values it only returns an array with 119 values, this I have tested both locally and on a live site and are both having issues.
array:6 [▼
"_token" => "hidden"
"_method" => "PUT"
"datasheet_id" => "347"
"test_engineer" => "hidden"
"ancillary_tools" => array:11 [▶]
"tool" => array:119 [▶]
]
You can see here the tool array on the request only has 119 values. I cannot figure out why this is the case... does anyone have any ideas?
<form class="" action="{{ route('certificates.noise.update', compact('organisation', 'site', 'noise')) }}" method="post" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="form-group">
<select class="form-control" name="datasheet_id">
<option value="">Select a Datasheet</option>
@foreach ($site->data_sheets as $datasheet)
<option @if ($noise->datasheet_id == $datasheet->id) selected="selected" @endif value="{{ $datasheet->id }}">{{ $datasheet->created_at->format('dS F Y') }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<input placeholder="Test Engineer" class="form-control" type="text" name="test_engineer" value="{{ $noise->test_engineer }}" />
</div>
<div class="form-group">
<table class="datasheet-table">
<tr>
<th scope="col">Apparatus</th>
<th scope="col">Location</th>
<th scope="col">Peak Noise Level</th>
<th scope="col">Comments</th>
<th scope="col"></th>
</tr>
@php
$tools = json_decode($noise->ancillary_tools);
@endphp
@foreach ($tools as $key => $tool)
<tr>
<td><input type="text" name="ancillary_tools[{{ $key }}][name]" value="{{ $tool->name }}" /></td>
<td><input type="text" name="ancillary_tools[{{ $key }}][location]" value="{{ $tool->location }}" /></td>
<td><input type="text" name="ancillary_tools[{{ $key }}][peak_noise]" value="{{ $tool->peak_noise }}" /></td>
<td><input type="text" name="ancillary_tools[{{ $key }}][comments]" value="{{ $tool->comments }}" /></td>
<td><button onclick="addRow({{ $key }})" type="button"><i class="fal fa-plus"></i></button></td>
</tr>
@endforeach
</table>
</div>
<div class="form-group">
<h2>Tool Data ({{ count($noise->datasheet->tools) }})</h2>
<table class="datasheet-table">
<tr>
<th scope="col">Serial Number</th>
<th scope="col">Description</th>
<th scope="col">Owner/User</th>
<th scope="col">Recorded Noise Level dB(A)</th>
<th scope="col">Typical Daily Exposure Time (Minutes)</th>
<th scope="col">Maximum Permissible Exposure Time (Hours/ Minutes)</th>
<th scope="col">Ear Protection to SRN value Required</th>
</tr>
@foreach($noise->datasheet->tools as $key => $tool)
@php
if ($tool->noise_level <= 80) {
$noise_level_colour = '#27ff11';
} elseif($tool->noise_level >= 81 && $tool->noise_level <= 85) {
$noise_level_colour = '#ffca11';
} elseif($tool->noise_level >= 86) {
$noise_level_colour = '#fa4f4f';
}
@endphp
{{-- @if($tool->noise_level > 80)--}}
<tr class="calculator">
<td class="serial-number"><input name="tool[{{ $key }}][serial_number]" type="text" value="{{ $tool->serial_number }}" /></td>
<td class="type"><input name="tool[{{ $key }}][type]" type="text" value="{{ $tool->type }}" /></td>
<td class="make"><input name="tool[{{ $key }}][make]" type="text" value="{{ $tool->owner->name }}" /></td>
<td class="tool-owner" style="background-color: {{ $noise_level_colour }}">{{ $tool->noise_level . 'dB' }}</td>
<td class="daily_exposure_time"><input name="tool[{{ $key }}][daily_exposure_time]" type="text" value="{{ $tool->daily_exposure_time }}" /></td>
<td class="max_exposure_time"><input name="tool[{{ $key }}][max_exposure_time]" type="text" value="{{ $tool->max_exposure_time }}" /></td>
<td class="srn_value"><input name="tool[{{ $key }}][srn_value]" type="text" value="{{ $tool->srn_value }}" /></td>
</tr>
{{-- @endif--}}
@endforeach
</table>
</div>
<div class="form-group">
<textarea placeholder="Action Plan" id="summernote" class="form-control" name="action_plan" rows="8" cols="80">{{ $noise->action_plan }}</textarea>
</div>
<div class="container">
<div class="row">
<div class="col">
<div class="form-group">
<label>Noise Graph 1</label><br />
<img style="width: 150px;" class="mb-2" src="{{ asset('storage/images/' . $noise->image_1) }}" />
<input class="form-control" type="file" name="image_1" />
</div>
</div>
<div class="col">
<div class="form-group">
<label>Noise Graph 2</label><br />
<img style="width: 150px;" class="mb-2" src="{{ asset('storage/images/' . $noise->image_2) }}" />
<input class="form-control" type="file" name="image_2" />
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>Noise Graph 3</label><br />
<img style="width: 150px;" class="mb-2" src="{{ asset('storage/images/' . $noise->image_3) }}" />
<input class="form-control" type="file" name="image_3" />
</div>
</div>
<div class="col">
<div class="form-group">
<label>Noise Graph 4</label><br />
<img style="width: 150px;" class="mb-2" src="{{ asset('storage/images/' . $noise->image_4) }}" />
<input class="form-control" type="file" name="image_4" />
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>Floor Plan</label><br />
<img style="width: 150px;" class="mb-2" src="{{ asset('storage/images/' . $noise->floorplan) }}" />
<input class="form-control" type="file" name="floorplan" />
</div>
</div>
</div>
</div>
<div class="form-group">
<input placeholder="Average Noise Level" class="form-control" type="number" name="average_noise" step="0.01" value="{{ $noise->average_noise }}" />
</div>
<button class="btn btn-primary btn-block" type="submit">Update</button>
</form>
Replied to Display Images Stored In S3 In Blade Files
I seem to be getting the same result with this as i was before.
as a note because i was using the AmazonS3FullAccess Policy the json was previously which should allow everything anyway should it not:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*"
}
]
}
Replied to Display Images Stored In S3 In Blade Files
I already have that installed or I wouldn't have been able to do the uploads
Started a new Conversation Display Images Stored In S3 In Blade Files
Hi,
I am trying to store images in S3 and then display them on blade files in my application however I am getting a 403 Forbidden error when trying to load the image.
My IAM user has full access to S3 and I have uploaded the image through the application but seem to be unable to display it.
<img class="border-gray" height="50px;" src="{{ Storage::disk('s3')->url($this->company->logo) }}" alt="...">
I have had no issues with uploading/downloading files but for some reason I am unable to display the image, any advice would be appreciated.
Thankyou!
Replied to Livewire Maths - Calculate A Live Total
I cant believe I didn't just see the simple solution, awesome thanks!
Started a new Conversation Livewire Maths - Calculate A Live Total
Hi,
Wondering if anybody can give me some pointers, I'm using livewire to get 3 int values as they are typed however how can I use livewire to update a live total as these are updating?
I have tried just calling a function on the total field but that doesnt seem to work:
wire:model="calcTotalConstruction()"
Replied to Livewire Pagination Stops Working After A Couple Requests
I found the solution to this, so anyone else that comes across this is aware you need to use wire:key on the foreach tr as shown below
@foreach($stores as $store)
<tr wire:key="{{ $store->id }}">
<td>{{ $store->name }}</td>
</tr>
@endforeach
Started a new Conversation Livewire Pagination Stops Working After A Couple Requests
Has anyone experienced this?
I'm not really sure what to show here, so here are the pagination links
{{ $stores->appends(request()->query())->links() }}
and then I am using this in the render method
$stores = Programme::orderBy('store_id', 'ASC')
->paginate(8);
return view('livewire.dashboard.main-table', compact('stores'));
And every single time if a user selects few more than a handful of pages then it will just stop making requests.
Anybody have any suggestions?
Replied to Livewire Not Passing Appends In Paginator
I would say this is the best practise method so that's awesome, thank you.
Sorry I guess I never even though to mention the version of Livewire I was using!
But thank you for your help with it never the less.
Replied to Livewire Not Passing Appends In Paginator
I found a solution to this and In order for me to use the params I have stored in the URI I had to mount these, so doing the following in the livewire component then made them accessible.
Not quite sure why they where not working use the other methods.
public $region;
public $year;
public $scope;
public function mount()
{
$this->region = request()->region;
$this->year = request()->year;
$this->scope = request()->scope;
}
Replied to Livewire Not Passing Appends In Paginator
Well this is really strange then, I have just changed my code to be using the request()
global helper and the view to be:
{{ $stores->appends(request()->query())->links() }}
and my livewire component to be:
public function render()
{
dump(request()->all());
}
and I am still getting the same results dumped with this uri: ?region=all&year=All&scope=All&page=2
array:3 [▼
"fingerprint" => array:3 [▶]
"serverMemo" => array:6 [▶]
"updates" => array:1 [▶]
]
Have you made any other changes to your component when doing this and are you using the render method?
Replied to Livewire Not Passing Appends In Paginator
I am only dumping $request->all()
so I can see the whole contents of the request.
The URL is: /dashboard?region=all&year=All&scope=All
this does work completely fine on the first page load and dumps:
array:3 [▼
"region" => "all"
"year" => "All"
"scope" => "All"
]
however then when clicking one of the pagination links it then outputs:
array:3 [▼
"fingerprint" => array:3 [▶]
"serverMemo" => array:6 [▶]
"updates" => array:1 [▶]
]
the URL then updates to: /dashboard?region=all&year=All&scope=All&page=2
although no results are shown because the request is not passed.
Replied to Livewire Not Passing Appends In Paginator
Hi,
just given this a try and I get the same output as my above example. :(
Started a new Conversation Livewire Not Passing Appends In Paginator
Normally if i wanted to pass the current URI params when using the laravel pagiantor I would use the following:
<td colspan="14">{{ $stores->appends($request->all())->links() }}</td>
However when I try and do this on a livewire component and try dump out the request I am just getting an array containing this:
array:3 [▼
"fingerprint" => array:3 [▼
"id" => "SdUXNTxbkwML8KRdlQzl"
"name" => "dashboard.main-table"
"locale" => "en"
]
"serverMemo" => array:6 [▼
"children" => []
"errors" => []
"htmlHash" => "ce8cbb71"
"data" => array:3 [▶]
"dataMeta" => []
"checksum" => "176fdbaa1fad271b67f11674af16e71ce8e0d52b7d8959d10e883f0d1bf20f02"
]
"updates" => array:1 [▼
0 => array:2 [▶]
]
]
How can I use the livewire paginator and still pass params to it in the process?
edit 1: when outputting i am doing the following:
use Illuminate\Http\Request;
...
public function render(Request $request)
{
dump($request->all());
}
SOLUTION: In order for me to use the params I have stored in the URI I had to mount these, so doing the following in the livewire component then made them accessible.
public $region;
public $year;
public $scope;
public function mount()
{
$this->region = request()->region;
$this->year = request()->year;
$this->scope = request()->scope;
}
Awarded Best Reply on How To Disable Livewire Tailwind Pagination In Laravel Blades?
Referencing the Laravel 8 docs: https://laravel.com/docs/8.x/upgrade#pagination
The paginator now uses the Tailwind CSS framework for its default styling. In order to keep using Bootstrap, you should add the following method call to the boot method of your application's AppServiceProvider:
use Illuminate\Pagination\Paginator;
Paginator::useBootstrap();
I hope this helps.
Replied to How To Disable Livewire Tailwind Pagination In Laravel Blades?
Sorry I just realised this said livewire... Looking at the livewire docs (https://laravel-livewire.com/docs/2.x/pagination) you have to make the following change to use bootstrap:
class ShowPosts extends Component
{
use WithPagination;
protected $paginationTheme = 'bootstrap';
Replied to How To Disable Livewire Tailwind Pagination In Laravel Blades?
Referencing the Laravel 8 docs: https://laravel.com/docs/8.x/upgrade#pagination
The paginator now uses the Tailwind CSS framework for its default styling. In order to keep using Bootstrap, you should add the following method call to the boot method of your application's AppServiceProvider:
use Illuminate\Pagination\Paginator;
Paginator::useBootstrap();
I hope this helps.
Started a new Conversation Advice On Custom Fields
Hi all,
So I am building a CRM system for work and they are keen for me to implement custom fields in the sections.
For example an Account would contain generic data such as name and address but would then need to add custom fields depending on the user, they also need to be able to choose the field type such as; text, textarea, int etc
I hope this makes..
I have been thinking about this but I'm not quite sure how I would go about implementing this.
The best I can think of is have one table filled with all the custom fields and the types, defaults etc that would go with them. Then aa second table with the custom field values?
I would love insights on how other may have achieved this or if there is an easier way than what I have described
Thanks guys! stay safe