DivDax

Hire Me

Experience

27,790

8 Best Reply Awards

  • Member Since 4 Years Ago
  • 374 Lessons Completed
  • 4 Favorites

17th April, 2018

DivDax left a reply on Route() In Mail Generates Urls With Serverip Instead Of Domain • 2 months ago

Thank you @Snapey! You're my man! After clearing the config cache everything works like it should...

DivDax left a reply on Route() In Mail Generates Urls With Serverip Instead Of Domain • 2 months ago

When sending a mail there is no http request, right.

But why route() generate the url with my server ip instead of my APP_URL i defined in my .env?

16th April, 2018

DivDax left a reply on Route() In Mail Generates Urls With Serverip Instead Of Domain • 2 months ago

The $request variable is not the typical Illuminate\Http\Request and contains data because i passed it manually to the mailable. The main Problem is the base url.

The generated route link contains the server ip. This:

http://123.123.123.123/status/a3dcb4d229de6fde0db5686dee47145d

should be:

http://envappdomain.com/status/a3dcb4d229de6fde0db5686dee47145d

and in my .env the APP_URL is set to http://envappdomain.com

DivDax left a reply on Route() In Mail Generates Urls With Serverip Instead Of Domain • 2 months ago

@Snapey The mail is "queued" but the driver is sync.

@PovilasKorop The APP_URL is set:

APP_URL=http://envappdomain.com
QUEUE_DRIVER=sync

Why the urls are not equal? It's the same email and both urls are generated with the route helper... hmm...

DivDax started a new conversation Route() In Mail Generates Urls With Serverip Instead Of Domain • 2 months ago

Hey,

i moved a project and have a strange behavior when sending mails. This is my mail content:

click here: {{ route('status', $request->hash) }}
file: {{ $file->downloadUrl() }}

when i receive this mail it looks like this:

click here: http://123.123.123.123/status/a3dcb4d229de6fde0db5686dee47145d
file: http://envappdomain.com/file/1234

$file->downloadUrl() also uses the route() helper...

public function downloadUrl()
{
    return route('files.download', $this->hash);
}

Any idea?

5th March, 2018

DivDax left a reply on Using Variables In Mailable Templates • 3 months ago

All public properties are available as variable in your mailable view: https://laravel.com/docs/5.6/mail#view-data

24th February, 2018

DivDax left a reply on Framework7 • 3 months ago

I'm interested in this too. I also like ionic, but the stencil based version isn't final yet.

16th February, 2018

DivDax left a reply on How To Make Dynamical Column. • 4 months ago

select() wants an array! In your case use selectRaw().

8th February, 2018

DivDax left a reply on How I Can Force All My Routes To Be HTTPS Not HTTP • 4 months ago

I would place this in the AppServiceProvider in the boot() method, or maybe create a ForceHttpsMiddleware

if($this->app->environment('production')) {
    URL::forceScheme('https');
}

31st January, 2018

DivDax left a reply on How Do You Generate Links? • 4 months ago

Most of the time i use name routes for links:

// old style
Route::get('/test/url', ['uses' => '[email protected]', 'as' => 'test_routename']);
// new style
Route::get('/test/url', '[email protected]')->name('test_routename');
<a href="{{ route('test_routename') }}">Linktext</a>

29th January, 2018

DivDax left a reply on Commenting System Like Facebook • 4 months ago

I'm searching for a private self hosted solution. I know how to use facebook/disqus comments. :)

26th January, 2018

DivDax started a new conversation Commenting System Like Facebook • 4 months ago

Hey guys,

do you know any existing commenting system like facebooks comments with like feature, load more comments/lazy loading?

10th October, 2017

DivDax left a reply on Phpunit: How To Test Write To Log File • 8 months ago

Thank you @druc. :)

DivDax started a new conversation Uniform Response - Pattern? • 8 months ago

Hey!

i want to use different api services and every service gives me another response. Let's say i have ServiceA and ServiceB to create a user.

ServiceA gives me a response like this

{
  'status': 200,
  'error': false
}

ServiceB gives me a response like this

{
  'created': 'OK',
  'error': false,
  'user': {
    'name': 'test',
    'email': '[email protected]',
  }
}

I created a driver based class to create those users with my own api like:

$response = UserService::newUser('test','[email protected]');

How you would "uniform" the response from each service?

I want to use my own api like:

$response->getStatusCode(); // should return 200 for both services

DivDax started a new conversation Phpunit: How To Test Write To Log File • 8 months ago

i'm really new to phpunit testing and want to test if something was written to the logfile. How you would test this?

18th July, 2017

DivDax left a reply on Invalid CSRF Token • 11 months ago

The hidden token field is auto generated by the illuminate Form class.

DivDax started a new conversation Invalid CSRF Token • 11 months ago

Hey guys,

i have a confusing problem with CSRF-Token validation. Every form has a hidden _token input. Sometimes there is even a page with multiple forms and of course a hidden _token field.

Its a app for a client and he works with multiple tabs and report the problem he often get the error "InvalidTokenMismatch" even when the page is "fresh". He doesn't idle for a long time.

Any thoughts? Session timeout is at the default 120 min (database). Any problems on using the site with multiple tabs?

it's very confusing...

24th May, 2017

DivDax left a reply on Package Development How To Install Package Requirements • 1 year ago

Please reread my post... ;)

i know how to install packages via composer. My question ist how to install the package requirements when developing a package thru the package composer.json

DivDax started a new conversation Package Development How To Install Package Requirements • 1 year ago

Hey guys,

i'm relative new to package development in laravel and want to know you install required packages inside your package composer.json? What's the easiest way to install the requirements inside the project root with composer update?

4th April, 2017

DivDax left a reply on Select Options Unsorted • 1 year ago

That's Vue.js v1. But i fixed it and get a ordered select list.

First i've changed my object to:

[  
   {  
      "id":13,
      "name":"A World Without Heroes"
   },
   {  
      "id":749,
      "name":"Ambassade Records"
   },
   {  
      "id":42,
      "name":"Bang It"
   },
   {  
      "id":1029,
      "name":"Be Crazy Music"
   },
   ...
]

and updated my HTML:

<option v-for="label in labels" :value="label.id" :selected="label_selected == label.id ? 'selected' : ''">@{{label.name}}</option>

DivDax left a reply on Select Options Unsorted • 1 year ago

Same error as before, but i also need to pass the id as option value. I'm using Vue.js v2.2.6.

DivDax left a reply on Select Options Unsorted • 1 year ago

THen i got this error:

- invalid expression: v-for="(name, id) in labels | orderBy 'name'"

DivDax started a new conversation Select Options Unsorted • 1 year ago

Hey,

I've an object of names and list them in a select element with vue. My Object is already ordered by name/value but vue renders it and sort it by keys. How to show the ordered list with vue?

<select name="label_id" id="label_id" v-model="label_selected">
    <option value=""></option>
    <option v-for="(name, id) in labels" :value="id" :selected="label_selected == id ? 'selected' : ''">@{{name}}</option>
</select>

My object:

{  
   "13":"A World Without Heroes",
   "749":"Ambassade Records",
   "42":"Bang It",
   "1029":"Be Crazy Music",
   "75":"Body Music",
   "76":"Bongo Tone",
   "83":"Brise Records",
   "86":"Casa Loca",
   "93":"Check In Recordings",
   "103":"Club Session",
   "106":"Clubrockerz Music",
   "737":"Congos Records",
   "1171":"Craft Music",
   "993":"Deep City Grooves",
   "747":"Electrade Records",
   "753":"Fine-Tune Records",
   "1127":"FUKAI MUSIC",
   "1199":"G-High",
   "217":"Get Down Recordings",
   "1007":"Great Stuff Recordings",
   "1175":"Honky Tunes",
   "1345":"HoTL Records",
   "249":"Housesession Records",
   "739":"Influence Recordings"
}

31st January, 2017

DivDax started a new conversation Changing Console Output? • 1 year ago

Hey guys,

it is possible to output a changing value like composer update? Downloading... 0% 5% ... 100%

11th January, 2017

DivDax left a reply on Encrypt/decrypt Model Attributes - Invalid Payload • 1 year ago

Problem solved! :) I had to change the column typ to text instead of string so the full encrypted value can be stored... haha

DivDax started a new conversation Encrypt/decrypt Model Attributes - Invalid Payload • 1 year ago

Hey!

i want to encrypt some data before saving it to the database. (APP_KEY in .env is set)

My model looks like this to encrypt/decrypt the data for certain column:

public function setAmazonKeyAttribute($val)
    {
        $this->attributes['amazon_key'] = encrypt($val);
    }

    public function getAmazonKeyAttribute()
    {
        return decrypt($this->attributes['amazon_key']);
    }

    public function setAmazonSecretAttribute($val)
    {
        $this->attributes['amazon_secret'] = encrypt($val);
    }

    public function getAmazonSecretAttribute()
    {
        return decrypt($this->attributes['amazon_secret']);
    }

I used the save APP_KEY for encrypting. When i try to load a view to show the data, i get the following error:

ErrorException in Encrypter.php line 144:
The payload is invalid. (View: /home/vagrant/www/.../index.blade.php)

Any suggestions? :)

21st December, 2016

DivDax left a reply on Elixir - Deleting Local Variable In Strict Mode • 1 year ago

@JeffreyWay Why the useStrict get removed? (laravel-elixir ^6.0.0-15) i pulled the latest release and get the same error while not using strict.

20th December, 2016

DivDax started a new conversation Send Raw Text Mail Without Using A View In Laravel 5.3 • 1 year ago

Hey,

it is possible to send a mail with a string as body without using a blade view?

17th October, 2016

DivDax left a reply on Delete Jobs From Beanstalk Queue • 1 year ago

No ideas?

13th October, 2016

DivDax started a new conversation Delete Jobs From Beanstalk Queue • 1 year ago

Hey guys,

i have to upload a compilation with many large files to a ftp server. The user clicks on "Upload compilation", i push each track (file) into my queue, and the user get a short info about the upload was started. Everything works well.

Every upload (compilation + tracks) is stored in the database for logging to see which compilation is uploaded and if it's finished.

Now i want to delete a running upload from the database (no problem at all) AND from my queue. (each pushed track) but beanstalk has no job ids or something else to delete a certain job after i pushed one...

How you would tackle this problem?

14th August, 2016

DivDax left a reply on Auto Return JSON With .json Extension For All Get Requests • 1 year ago

Route::get('/vendors{ext?}', '[email protected]');

class VendorController {
  public function handle($ext) {
    if($ext == '.json') {
      //...
    }
  }
}

10th August, 2016

DivDax left a reply on Issues Debugging Laravel App With Xdebug, Homestead And Phpstorm • 1 year ago

I've the same problem.

19th July, 2016

DivDax left a reply on DOMPDF And Loading Routed Images • 1 year ago

Had the same problem. Get your route out of the route group where you use a middleware with auth.

15th July, 2016

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

This works for me:

$clients->whereHas('appointments', function($q) use ($val) {
  $q->havingRaw("MAX(start_date) < '".Carbon::now()->subMonths($val)->format('Y-m-d')."'");
});

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

How you would do this in eloquent @EventFellows ? :)

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

SQLSTATE[HY000]: General error: 1111 Invalid use of group function (SQL: select count(*) as aggregate from `clients` where `clients`.`deleted_at` is null and (select count(*) from `appointments` where `appointments`.`client_id` = `clients`.`id` and MAX(start_date) < '2016-01-15' and `appointments`.`deleted_at` is null group by `client_id` order by `start_date` desc) >= 1)

i also get this error when i'm not using the groupBy(). Hmm

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

I want to get all clients where the latest related appoint is older than x days.

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

No :( Just get clients with appointments which are not older than 30 days.

DivDax left a reply on Select Clients Where Latest Appointment Is Older Than 30 Days • 1 year ago

This does not work @SaeedPrez. latest() orders my appointments by created_at column which has not to be the latest appointment. I came up with this but this also does not work:

$clients->whereHas('appointments', function($q) use ($val) {
  $q->whereRaw("date(start_date) < '" . Carbon::now()->subMonths($val)->format('Y-m-d') . "'")
    ->orderBy('start_date','desc')
    ->limit(1)
    ->groupBy('client_id');
});
select * from `clients`
where `clients`.`deleted_at` is null
  and (
    select count(*)
    from `appointments`
    where `appointments`.`client_id` = `clients`.`id` and date(start_date) < '2016-01-15' and `appointments`.`deleted_at` is null
    group by `client_id`
    order by `start_date` desc limit 1
  ) >= 1
limit 25

DivDax started a new conversation Select Client Where Latest Appointment Is Older Than 30 Days • 1 year ago

Hey!

I want to select all clients where the LAST related appointment (start_date) is older than 30 days.

My Relation: Client hasMany Appointments

$clients = Client::whereHas('appointments', function($q) {
    $q->where('start_date', '<', Carbon::now()->subDays(30)->format('Y-m-d'));
})->get();

The Problem is every client has many appointments and if any of them is older than 30 days i get a result.

24th June, 2016

DivDax left a reply on Importing 50k+ Rows To Database From CSV • 1 year ago

Using LOAD DATA INFILE is by far the fastest option.

21st December, 2015

DivDax left a reply on A Question Regarding S3 Use-case • 2 years ago

There is no problem with 5 mio articles in mysql i think. How you produce high load? Search thru your articles? Then use an indexing service like elastic search etc.

5th December, 2015

DivDax left a reply on Running Multiple Cron Threads And Monitoring Them • 2 years ago

To prevent overlapping jobs use two timestamps for your jobs e.g. job_start_at and job_finished_at. Then check if there are jobs where job_start_at != NULL and job_finished_at = NULL and you know if there is a running job.

29th November, 2015

DivDax left a reply on Carbon Display Age In Years, Months, Day • 2 years ago

Use Carbon: http://carbon.nesbot.com

var_dump(Carbon::createFromDate(1975, 5, 21)->age);

19th November, 2015

DivDax left a reply on New To Eloquent, But Can't Make This Simple Relationship Work! • 2 years ago

In your case: A Person belongsTo a Category. A Category hasMany Person.

26th September, 2015

DivDax left a reply on Route • 2 years ago

It's a named route you can access with route('home')

24th September, 2015

DivDax left a reply on Spark + Multi-Tenancy • 2 years ago

+1 very interested in this too! :)

10th September, 2015

DivDax left a reply on Pagination Help/Logic • 2 years ago

If you just want to use previous/next links for pagination use

DB::table('users')->simplePaginate(15);

For more information read: http://laravel.com/docs/5.1/pagination

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.