Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

DivDax

Hire Me

Experience

17,580

6 Best Reply Awards

  • Member Since 3 Years Ago
  • 286 Lessons Completed
  • 4 Favorites

10th October, 2017

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

Thank you @druc. :)

DivDax started a new conversation Uniform Response - Pattern? • 2 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 • 2 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 • 4 months ago

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

DivDax started a new conversation Invalid CSRF Token • 4 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 • 6 months 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 • 6 months 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 • 8 months 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 • 8 months 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 • 8 months ago

THen i got this error:

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

DivDax started a new conversation Select Options Unsorted • 8 months 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? • 10 months 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 • 11 months 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 • 11 months 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 • 11 months 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 • 11 months 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 • 1 year 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

12th August, 2015

DivDax started a new conversation Order By Column (relation) • 2 years ago

Hey all,

is there an easy way to order table data by a column which is a relation? I know i have to join the related data to sort them, but do you know a good package for it?

At the moment i'm using this helper function to sort table data:

if(! function_exists('link_to_route_sort'))
{
    function link_to_route_sort($col, $name)
    {
        $query = Request::except('page');
        $query['sortBy'] = $col;
        $query['order'] = Input::get('order') == 'asc' ? 'desc' : 'asc';

        // build url
        $current_controller = Route::getCurrentRoute()->getAction()['controller'];
        $url = action($current_controller);
        $url .= '?'.http_build_query($query);

        // html link
        $html = '<a href="'.$url.'">'.$name.'</a>';

        // order icon
        if(Input::get('sortBy') == $col)
        {
            $class = $query['order'] == 'asc' ? 'down' : 'up';
            $html .= '<i class="fa fa-fw fa-caret-'.$class.'"></i>';
        }

        return $html;
    }
}

7th August, 2015

DivDax left a reply on Security Fix: PSA: Hide Your .git/config Directory • 2 years ago

In Laravel projects your .git directory is outside the public directory, so there no problem as described. ;)

15th July, 2015

DivDax left a reply on Vue.js Debounce Not Working As Expected. • 2 years ago

Same problem here. Did you solve this?

13th July, 2015

DivDax left a reply on Laravel 5.2 (What Features Do We All Want?) • 2 years ago

What about an integrated deploy workflow?

30th May, 2015

DivDax left a reply on Supervisor And Artisan Queues • 2 years ago

@zupolgec Did you find a solution?

4th May, 2015

DivDax left a reply on Using Knp-Snappy With Laravel Homested -- Css File Not Working? • 2 years ago

Or set the option:

$snappy->setOption('user-style-sheet', '/your/file.css');

2nd May, 2015

DivDax left a reply on Supervisor And Artisan Queues • 2 years ago

Same here. I'm using rocketeer to deploy my app and my latest release has a symlink "/var/www/myapp/current" -> "/var/www/myapp/releases/20150501010203". I think supervisord is caching the real path from my symlink folder, so i have to restart the queue manually... :(

8th February, 2015

DivDax left a reply on DD Laravel 5 • 2 years ago

Kint is also very useful and one of the best debug tools i've ever seen: http://raveren.github.io/kint

6th February, 2015

DivDax left a reply on Append In Eloquent In Most Cases A Where Condition • 2 years ago

Have a look at https://github.com/AuraEQ/laravel-multi-tenant I think that's what you're looking for. :)

DivDax left a reply on Routing Placeholder For Resourceful Routings • 2 years ago

You're wrong. In L4 the id parameter had the same name as your resource route:

Route::resource('todo', 'TodoController');
...
contacts/{contacts}/edit
...

Why this should be a problem?

3rd February, 2015

DivDax left a reply on View Load In A Popup • 2 years ago

What is not working? Show some code or describe your problem.

1st February, 2015

DivDax left a reply on Anyone Using Jade, Slim, Or ...? • 2 years ago

Anyone combined jade with blade?

20th January, 2015

DivDax left a reply on Remove Download File If Download Canceled • 2 years ago

If you're using Homestead it should work out of the box. I never had a problem or installed the required mod. To work with temp files why not empty the folder every hour or at midnight? Of course only files older than 1 hour or so?

Edit Your Profile
Update

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