5,000 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.
skoobi left a reply on Not Ordering OrderByRaw('SOUNDEX(username), LENGTH(username), Username Desc')
Ive tried several variations of
orderByRaw('SOUNDEX(username), LENGTH(username), username desc')
but as an example If i am at user BT101 (last of the BT users) and then click previous, I would expect to get the last of the A users, so in this case A1476, but it doesnt. It jumps straight to A989 which is correct in terms of its the last user in that order if it was in numerical.
skoobi started a new conversation Not Ordering OrderByRaw('SOUNDEX(username), LENGTH(username), Username Desc')
Hi.
I'm having an issue when trying to order the users by username and using as a next / previous button!
I am using view composer to populate a sidebar that has a previous and next button.
I then get the current id from the URL segment and find the current user.
How i want them ordered is by Username as follows :::
A001 A009 A110 A212 A330 A789 A982 A1012 A1234
BT001 BT009 BT110 BT212 BT330 BT789 BT982 BT1012 BT1234
SA001 SA009 SA110 SA112 SA330 SA789 SA982 SA1012 SA1234
etc...
But they're not showing up like this. They either go from A1500 to A150 or when it get to the next row of usernames it just goes back the the start.
Here's the code i have already:::
$user = Auth::user();
$id = request()->route('id');
$customer = User::where('id', $id)->first();
$mail_centre_id = MailCentreHelper::get_mail_centre_id();
$previous = User::where('username', '<', $customer->username)
->findMailCentre($mail_centre_id)
->orderByRaw('SOUNDEX(username), LENGTH(username), username desc')
->status([1,2,3,4,5,6,9])
->pluck('id')
->first();
$next = User::where('username', '>', $customer->username)
->findMailCentre($mail_centre_id)
->orderByRaw('SOUNDEX(username), LENGTH(username), username asc')
->status([1,2,3,4,5,6,9])
->pluck('id')
->first();
Any help or ideas would be grateful..
Many thanks
skoobi left a reply on Urgent Help Needed, Even Google Couldn't Answer- Please Help. Laravel Test Fails..
Have you checked the test .env file. When you run tests, it creates a separate .env file to run.
You can create a .env.testing
file to add your credentials etc for the test environment.
https://laravel.com/docs/5.7/testing
Thats my only idea on it i think. :)
skoobi left a reply on QueryException In Connection.php Line 770:
Looking at the result it may be its not passing 'stream_id' through.
If you don't need the stream_id (which looks like you may do) then you can set it to null in the database or nullable() in the migration.
skoobi left a reply on Looping Through A Json Object?
Sorry for the late reply. I don't seem to be getting any emails from Laracast!
I have done as you have here but I'm getting `Cannot use object of type stdClass as arr
The one thing which I need to try and get working is that telephone etc can change. I.e. it may be name
or address
etc
Ive tried so many different things to try to get it to work that im at a loss.
I like the Accessors, I've learned something new :)
skoobi left a reply on Looping Through A Json Object?
Ok im pretty confused.
Ive tried to access
{
"type":"account",
"old":{
"telephone":"12345678",
"email":"[email protected]"
},
"new":{
"telephone":"12345678333",
"email":"[email protected]"}
}
By using
// Get the record
$data = CustomerActivity::where('user_id', $user->id)->get();
$activities = json_decode($data);
// In blade
@foreach($activities as $activity)
<tr>
<td>{{ \Carbon\Carbon::parse($activity->created_at)->format('d/m/Y H:i:s') }}</td>
<td class="textLeft">
<strong style="text-transform: capitalize;">Old</strong>:: {{ $activity->data }} <br>
{{-- <strong style="text-transform: capitalize;">New</strong>:: {{ $activity->data['new']['telephone'] }} --}}
</td>
</tr>
@endforeach
// The dd output
array:1 [▼
0 => {#822 ▼
+"id": 29
+"user_id": 447
+"data": "{"type":"account","old":{"telephone":"123456783","email":"[email protected]"},"new":{"telephone":"123456783333","email":"[email protected]"}}"
+"old": null
+"new": null
+"type": null
+"created_at": "2019-01-28 15:27:32"
+"updated_at": "2019-01-28 15:27:32"
}
]
// What I have tried
{{ $activity->data->new['telephone'] }}
{{ $activity->data['new']['telephone'] }}
{{ $activity['data']['new']['telephone'] }}
{{ $activity['data']->new['telephone'] }}
// Also user the $activity[0] etc.. Cant remember what gave me the 'data'. I think it was if I returned the $activity in the view.
But none seem to work. I know in the grand scheme of it all it will need to be a $key, $val instead of the telephone as it will be dynamic, but if I can get it working then I'll have a bit of a chance.
Is there any Laracast videos which go into this in detail? Or can someone help with this.
Many thanks
skoobi left a reply on Looping Through A Json Object?
Hi @mikemacdowell.
Thank you for your reply. I forgot to reword the post. I changed the database to grab the encoded json and add it all like so::
$data = json_encode([
'type' => 'account',
'old' => [
'telephone' => Auth::user()->details->telephone,
'email' => Auth::user()->email
],
'new' => [
'telephone' => $request->get('telephone'),
'email' => $request->get('email')
]
]);
which produces '{"type":"account","old":{"telephone":"12345678","email":"[email protected]"},"new":{"telephone":"12345678333","email":"[email protected]"}}'
For whatever reason I cannot for the life of me get it to display the correct data.
Many thanks
skoobi started a new conversation Looping Through A Json Object?
Hi., Sorry I don't do much with JSON and am trying to learn/use it more to learn.
I wanted to add a custom activity tracker to a small test project I have that tracks the old and new values from a webform. So if a user updates their phone number it logs the old value and the new one.
The way it works at the moment is that when an user saves their details, It grabs the old data and the new data and saves it to the database under old and new columns::
public function saveActivity($request)
{
$data = json_encode([
'type' => 'account',
'old' => [
'telephone' => Auth::user()->details->telephone,
'email' => Auth::user()->email
],
'new' => [
'telephone' => $request->get('telephone'),
'email' => $request->get('email')
]
]);
$activity = Helpers::saveUserActivity($data);
}
this saves the data into the data field along with the authenticated user id.
What I can quite get my head around is displaying it on a blade template.
The issue I think I'm going to get is if theres a different types which I want to filter and there will be different fields depending on the type.
Can someone point me in the right direction with this one.
Many thanks
skoobi left a reply on Validation Issue?
Just checked and im not passing through the public $validator;
So should look like
public $validator;
**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'courier_id' => 'required_if:send_by,4|numeric',
];
}
/**
* Overrid Handle a failed validation attempt.
*
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function failedValidation(\Illuminate\Contracts\Validation\Validator $validator)
{
$this->validator = $validator;
}
skoobi left a reply on Validation Issue?
Ah ok. Strange as it works on other validation. Ill have to go back and double check that its the same as the others and not been changed ...
Cheers
skoobi started a new conversation Validation Issue?
Hi. Im getting an odd issue where I cannot validate inputs.
When trying to add a required_if attribute to the courier_id field it comes back ass a pass.
The strange thing is, if I make it a required field it also passes.
Controller (for testing)::
public function store(StoreDespatchRequest $request, User $user)
{
if (isset($request->validator) && $request->validator->fails()) {
Toaster::danger("It looks like there is a problem!!");
return redirect()->back()->withErrors($validator)->withInput();
}
return $request->all();
}
StoreDespatchRequest::
**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'courier_id' => 'required_if:send_by,4|numeric',
];
}
/**
* Overrid Handle a failed validation attempt.
*
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function failedValidation(\Illuminate\Contracts\Validation\Validator $validator)
{
$this->validator = $validator;
}
View::
<div class="row despatchSection">
<label class="inlinelabel">SEND BY</label>
<select class="despatchSelect" name="send_by" id="send_by">
@foreach($forwarding_by as $sent_by)
<option value="{{ $sent_by->id }}" @if($customer->forwarding->forward_by_id == $sent_by->forward_by_id) selected @endif>{{ $sent_by->title }}</option>
@endforeach
</select>
</div>
<div class="row despatchSection" name="courier">
<label class="inlinelabel">COURIER</label>
<select class="despatchSelect" name="courier_id" id="courier">
<option value=""></option>
@foreach($delivers_by as $deliver_by)
<option value="{{ $deliver_by->id }}">{{ $deliver_by->title }}</option>
@endforeach
</select>
</div>
Response::
{
_token: "uXeep3ih8wZeifdq4NpB51syruMZpYjq3EySnPy8",
letters_out: "2",
large_letters_out: "0",
parcels_out: "0",
send_by: "4",
courier_id: null,
tracking_ref: null,
postage_cost: "1",
total: "3.80"
}
Any ideas on why its not picking up null and passing the request
skoobi left a reply on Spatie Backup And Mysqldump
Hi @snapey. It's running under root. I'm presuming it has the correct rights to see the folder, its all set up using Forge. The rest of the crons work.
skoobi left a reply on Spatie Backup And Mysqldump
Ye that command works perfectly. This is what's confusing me!
skoobi left a reply on Spatie Backup And Mysqldump
Hi @dalma. Ye sure, In the config it has an array to specify a disk to backup to so
'destination' => [
/*
* The disk names on which the backups will be stored.
*/
'disks' => [
'local',
],
],
I have it set to ftp. and the connection is good and all works when running the backup via the console.
skoobi started a new conversation Spatie Backup And Mysqldump
Hi. Im getting an error when backing up to an ftp server through a task schedule.
The error is ::
Exception message: The dump process failed with exitcode 127 : Command not found : sh: 1: /usr/bin/mysqldump: not found
Now i know its installed because, well I installed it and i can run it from /usr/bin/mysqldump
and if i run the command to backup from ssh it also works fine. But when its scheduled it just keeps failing.
On my testing server which is an exact duplicate of the production server, it works perfectly!
Heres some of the code:::
Kernel.php
$schedule->command('backup:run --only-db')->everyThirtyMinutes()->environments(['production']); // set to 30min for testing...
config/database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
'dump' => [
'dump_binary_path' => '/usr/bin',
]
],
Any ideas. According to spatie its a server config issue but if I can run it via the command line on the server, surely it should work from the schedule...
Cheers
skoobi left a reply on OrderBy Not Quite How I Want It!
Ah, thank you, guys. I'll try that in a bit and report back.
skoobi left a reply on OrderBy Not Quite How I Want It!
Hi @snapey They go from A then BT, TF so Laravel is doing as it should but is there a way to order them by the string and numeric so its like so::
A101 A102 A111 A1101 BT101 BT134 TF455 TF456 etc.
whats happening at moment is
A101 A1001 A1002 A102 A1020
BT101 BT134 TF455 TF456
Cheers
skoobi started a new conversation OrderBy Not Quite How I Want It!
Hi.
I have a search query which grabs all the users and orders them by username.
In the search i use ->orderBy('username', 'asc')
which will order them to a point...
The issue I'm getting is if say username is, A100 and then there's A1000 its order is then A100, A1000, A1001, A1002 etc and later when it gets to A110 it then goes A1100 etc.
Is there a way to order them correctly.
Cheers
skoobi left a reply on Strip .php From Url
Ok so after a lot of digging around and learning about Nginx i found a solution...
In the nginx config file i added ::
rewrite ^/registration.php /registration permanent;
This works perfectly.
skoobi left a reply on Strip .php From Url
Sorry, Ive tried all sorts now and it fails on the Forge Digital ocean server using Nginx...
Locally it works perfect using Valet but as soon as its on the DO server i get No input file specified.
I cannot figure it out at all. Any ideas??
This is my middleware that catches all requests ::
public function handle($request, Closure $next)
{
if (str_contains($request->url(), '.php')) {
$url = str_replace('.php', '', $request->url());
return redirect($url);
}
return $next($request);
}
Cheers
skoobi left a reply on Strip .php From Url
Would that go in the
server {
$withoutExt = preg_replace('/\.[^.\s]{3,4}$/', '', $filename);
}
skoobi left a reply on Strip .php From Url
Thank guys. Im using nginx on forge. Im not going to lie but ive not used nginx before and a liitle afraid of messing with it.
But as a fix for now, I made a middleware to process the request and check for the extention and remove it then redirect to the correct location
if (str_contains($request->url(), '.php')) {
$url = str_ireplace('.php', '', $request->url());
return redirect($url);
}
skoobi left a reply on Forward Non Www To Www In Forge?
Sorry. Ive got a workaround for now...
I created a middleware to deal with the request.
public function handle($request, Closure $next)
{
if (str_contains($request->url(), 'https://my-app.uk')) {
return redirect('https://www.my-app.uk');
}
return $next($request);
}
Happy new year everyone :)
skoobi left a reply on Strip .php From Url
I have a URL on some old site links that at the moment usehttps://www.my-app.com/regestration.php
, on the new app that should be going to https://www.my-app.com/regestration
so by removing the .php from the end it will return the correct url.
skoobi left a reply on Forward Non Www To Www In Forge?
Hi, thank you for the reply. I tried that but unfortunately due to restrictions to the way the servers and old app was set up, I have some code that distinguishes the environment then sets the subdomains.
if (App::environment('local')) {
$sub = '';
$domain = 'my-app';
$tld = '.test';
} elseif (App::environment('testing')) {
$sub = 'testing.';
$domain = 'my-app';
$tld = '.uk';
} elseif (App::environment('production')) {
$sub = 'www.';
$domain = 'my-app';
$tld = '.uk';
}
Route::domain($sub . $domain . $tld)->group(function () {
Route::get('/testing', '[email protected]');
Route::post('/testing', '[email protected]');
Route::middleware(['guest'])->group(function () {
Route::get('/{page?}', 'Frontend\[email protected]');
});
});
Makes it a little more interesting lol.
skoobi started a new conversation Forward Non Www To Www In Forge?
Hi how do i forward requests to a certain routes file to www?
Many thanks
skoobi started a new conversation Strip .php From Url
Hi. Is there a way to strip any .php filenames from the end of the url.
Im using Forge and Digitalocean but was wondering if theres a way to do it through middleware?
Cheers
skoobi left a reply on 500 Error - Laravel Project Deployment On Shared Hosting
No problem. Did it work? If so mark the best answer.
Cheers
skoobi left a reply on 500 Error - Laravel Project Deployment On Managed Hosting
In the file structure you have there, in public the index should be the index.php not html. I’m the index.php it with have the route to the main app
skoobi left a reply on Connecting To Database From Local Machine
Sorry! Found the issue. Changed the port to 3307 and all worked. Cheers @d
skoobi left a reply on Connecting To Database From Local Machine
Sorry for the late reply guys...
I tried the tunnel but doesn't work for some reason. Once I have a bit more time to check it out I'll post back.
What ive done for now is used Brew to install MySQL on my local machine and MacBook and then just used it like that without connecting to the test DB server. Its a bit of a pain as I don't have the same data throughout all machines but I can live with it.
skoobi left a reply on Laravel Forge Scheduled Job No Such File Or Directory?
It may be an idea to check the Laravel error logs on the forge server to see if something has been logged there.
The second part is the schedule will use the time from the kernel file. So if you set the job to run daily in the kernel file then it will run daily.
skoobi started a new conversation Connecting To Database From Local Machine
Hi.
I've got 2 servers setup with Digital ocean which was provisioned using forge. I have one as an app server and the other a database server.
I can connect using ssh tunnel on sequel pro but unless I add my IP to the firewall in forge, I cannot connect to the server when using local dev. I try to use a testing db on the server so when I'm away from the office I can carry on with local dev with the same data.
Any ideas on how to allow my local computer to connect ??
Cheers
skoobi left a reply on Cashier Error, Name Cannot Be Null
Hi, @globals. Ye, I knew it wasn't passing but wasn't sure why as it was all fine on stripe end.
But figured it out by accident when tidying up the code.
So i done::
// This
$product = $user->pricing->stripe_product_id;
$plan = $duration . 'months';
// Params 1. Product 2. Plan
$user->newSubscription($plan, $plan)->create($stripeToken, [
'email' => $user->email,
]);
// Instead of this
$user->newSubscription($user->pricing->stripe_product_id, $duration . 'months')->create($stripeToken, [
'email' => $user->email,
]);
And now all works normally.
skoobi started a new conversation Cashier Error, Name Cannot Be Null
Hi.
I'm just trying to get the subscriptions working but I keep hitting this error,
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null in
Now I know it looks missing but that's all I'm doing so far is passing the data from vue to the controller and in the controller::
try {
$user = User::where('id', Auth::id())->with(['pricing'])->firstOrFail();
$duration = request('duration');
$stripeToken = request('stripeToken');
// Params 1. Product 2. Plan
$user->newSubscription($user->pricing->stripe_product_id, $duration . 'months')->create($stripeToken, [
'email' => $user->email,
]);
return response()->json(['status' => 'Your payment has been successful.'], 200);
} catch (\Exception $e) {
event(new NotifyIssues($user, $e));
$request->session()->flash('status', $e->getMessage());
$request->session()->flash('alert', 'danger');
return response()->json(['status' => $e->getMessage()], 422);
}
It creates the subscription in stripe and does the payment, but doesn't save to the subscriptions table.
Any ideas? Or more to the point, what am i missing?
skoobi left a reply on Activity Log
Fixed....
Turns out that when logging an activity, if a client logs-in then it saves it like so
{"user":447}
and if its to do with changing a value
{"attributes":{"telephone":"123456789"},"old":{"telephone":"1234567890"}}
skoobi started a new conversation Activity Log
Hi.
I'm trying to use Spatie ActivityLog to display all the activities on a page but I keep getting,
Undefined index: attributes
It used to work but for some reason, its stopped.
Heres the Code
// Controller
public function show($id)
{
$user = User::find($id);
$activities = Activity::where('causer_id', $user->id)->orderBy('created_at', 'desc')->get();
return view('admin.customers.settings-history.show')->with([
'activities' => $activities,
]);
}
// Blade
@foreach($activities as $activity)
<tr>
<td>{{ $activity->created_at->format('d/m/Y') }}</td>
<td>{{ $activity->created_at->format('H:i a') }}</td>
<td class="textLeft">
@foreach($activity->changes['attributes'] as $key => $val)
<strong style="text-transform: capitalize;">{{ $activity->description }}</strong> :: {{"$key"}} From "{{ $activity->changes['old'][$key] }}" to "{{ $activity->changes['attributes'][$key]}}"<br>
@endforeach
</td>
</tr>
@endforeach
Any ideas or help would be grateful.
Cheers
skoobi left a reply on Search Query Issue
I think a good feature request for Laracast would be a "Are you sure you've checked your code?" Lol...
Thank you so much, I ended up just taking the value and name out of the all so it just grabs everything anyway.
Thank you
skoobi started a new conversation Search Query Issue
Hi. I'm trying to search users using scopes but when trying to search for all, it only returns the wrong data. I.e I have in the searches form a checkbox with "All" "Active" "in-Active" but if I choose all it returns only the active for some reason.
// Controller
$users = User::role('Customer')
->findMailCentre($request->get('mail_centres'))
->HasStatus($request->get('status'))
->region($request->get('region'))
->type($request->get('type'))
->scans($request->get('scans'))
->sms($request->get('sms'))
->with(['account', 'settings'])
->get();
return $users;
// Model scope
public function scopeHasStatus($query, $status_id)
{
if (!$status_id) {
return $query;
}
return $query->whereHas('account', function ($query) use ($status_id) {
$query->orWhere('status_id', $status_id);
});
}
// Blade file
<h3>Status</h3>
<div class="broadcastWrapper">
<p style="text-transform: uppercase;"><input name="status[]" type="checkbox" id="all_statuses" /> ALL</p>
<div id="statuses">
@foreach($statuses as $status)
<p style="text-transform: uppercase;"><input name="status[]" value="{{ $status->id }}" type="checkbox"/> {{ $status->title }}</p>
@endforeach
</div>
</div>
Any help would be grateful.
Many thanks
skoobi left a reply on SHARED HOSTING PLESK + LARAVEL
The only thing I can think of is the ports. If your using SMTP on an insecure network then it's 25 or if it's secure it's 465 or 463 also try the encryption to tls
skoobi left a reply on SHARED HOSTING PLESK + LARAVEL
The mail host is normally something like
mail.domain.com
So in pleas when you setup a new email account you should be able to find the settings to setup that email address
skoobi left a reply on So, How Exactly Do You Get JQuery From Webpack To Work With Blade?
If it’s already compiled the you use
Or whatever the path to the app.js is
skoobi left a reply on Do "something" Once A Day In Laravel
If you get in touch with heroku support, they’re pretty good and can sort it out for you. But youll need a paid plan
skoobi started a new conversation Search For With Array But If Nothing Return All
Hi. I’m trying to get a filter running for a mass mailer that has multiple checkboxes, for example , all, pending, active etc. What I’m trying to get working is the return all if value is set to all.
What’s the best way of writing this. I’m using traits on the user model
Cheers
skoobi left a reply on Mail Not Sending Cc
Cheers for the reply. Hmm. Ye tried all them and nothing. Not quite sure what too do with it other than set another Mail::to to the 2nd email. If I use ->bcc()
it sends 2 copies to the original user and ignores the addresses in the bcc. Strange.
I'll be pushing the project up to the testing server in the morning, so may give it a shot to see its the localhost or something.
Cheers
skoobi left a reply on Php-cs-fixer Help
Cheers for the reply. I gave that a shot but it didn't do anything. Im not sure whats going on there. Ill give it another try in the morning just in case! Heres what I have in my .phpcsfixer
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'blank_line_before_statement' => ['if']
])
skoobi started a new conversation Php-cs-fixer Help
Hi.
I have got Php-cs-fixer up and running and its doing its thing, but I want it to automatically add a line above and below if else statements, i.e::
// from this
if ($payment_type == 1) { // New Account
$update_duration = $this->updateDuration($user, $duration);
$update_balance = CustomerCreditBalance::where('user_id', $user->id)->update(['current' => 20 - ($balance_transaction->fee / 100),]);
$account = CustomerAccount::where('user_id', $user->id)->update(['status_id' => 3]);
$payment = Ledgers::save($user, $transaction_type, $cost, $charge->id, null, $payment_title . ' - ' . $user->username, null, null, 5, $balance_transaction->fee / 100, 'Stripe');
event(new AccountSetupComplete($user, $payment));
} elseif ($payment_type == 2) { // Renewal 2-3
// To this
if ($payment_type == 1) { // New Account
$update_duration = $this->updateDuration($user, $duration);
$update_balance = CustomerCreditBalance::where('user_id', $user->id)->update(['current' => 20 - ($balance_transaction->fee / 100),]);
$account = CustomerAccount::where('user_id', $user->id)->update(['status_id' => 3]);
$payment = Ledgers::save($user, $transaction_type, $cost, $charge->id, null, $payment_title . ' - ' . $user->username, null, null, 5, $balance_transaction->fee / 100, 'Stripe');
event(new AccountSetupComplete($user, $payment));
} elseif ($payment_type == 2) { // Renewal 2-3
Any ideas on how to do it. I can seem to find the settings in the docs.
Cheers
skoobi started a new conversation Mail Not Sending Cc
Hi. Im trying to add cc to the Mail::to() and for some reason (probably me) its not working.
Mail::to($event->user->email)->cc('[email protected]')->send(new AccountRenewalEmail($event->user, $mailcentre, $payment));
It sends to the user but not the cc, an ideas?
Many thanks
skoobi left a reply on Integrity Constraint Violation: 1048 Column 'category_id' Cannot Be Null (SQL: Insert Into `posts`
I didn’t spot that on my phone lol. I knew it was something not being passed through.
skoobi left a reply on Integrity Constraint Violation: 1048 Column 'category_id' Cannot Be Null (SQL: Insert Into `posts`
Have you dd($request->all()) the request to see what it’s outputting. If I your getting an error saying it can’t be null then It’s not passing through the category, so you need to check that.
If your not expecting the category to be selected or to have any data passed then you need to setup the database column to allow null. So in the migration
$table->integer(‘category_id’)->nullable();