oroalej

Experience

3,620

1 Best Reply Awards

  • Member Since 8 Months Ago
  • 12 Lessons Completed
  • 0 Favorites

21st October, 2018

oroalej started a new conversation How To Use Laravel Request() Inside Vuejs • 1 day ago

Hi,

How can I use request() function of laravel inside vuejs. I'm trying to access the url parameters and currently i'm passing the values to javascript variable and accessing it from there. Is there a better way to do this?

Thank you guys!

oroalej left a reply on How To Stop Eager Loading When Model Already Have $with • 1 day ago

I found the problem, there's a getter that query the other tables. just need to refactor it and the issue is now fixed.

@Snapey It becomes a burden when your applicant gets bigger. Too many unnecessary calls. -_-

17th October, 2018

oroalej started a new conversation How To Stop Eager Loading When Model Already Have $with • 6 days ago

Hi,

How can i overwrite the $with in the model without removing it? I found setEagerLoads and it is working great. However, when I tried it to other relationship, it will not work.

select('id', 'name', 'slug', 'professional_category_id')
  ->withCount(['reviews', 'connections', 'ratings'])
  ->NoEagerLoads()       <- this is working, the scope is the same with the address.php
  ->IncludeMediaFile()
  ->with([
    'address' => function($query) {
      $query->select('city_id', 'city_name', 'state_name', 'addressable_id', 'addressable_type')
            ->noEagerLoads();
    }
  ])
                    

Address.php


  protected $with = [
        'city',
        'state',
        'country',
    ];

  public function scopeNoEagerLoads($query) {
      return $query->setEagerLoads([]);
    }

17th September, 2018

oroalej left a reply on Recommend Image Optimizer • 1 month ago

@martinbean Thanks dude. After checking our implementation, it doesn't have the second parameter so it was using the 90.

13th September, 2018

oroalej started a new conversation Recommend Image Optimizer • 1 month ago

Hi Guys,

Can you guys suggest a good image optimizer? I just saw a website that have 30KB image size in 720px size image while in our website, we have 300px with 150KB size.

Thank you

9th August, 2018

oroalej left a reply on Performance Increase Of Route::cache • 2 months ago

@bobbybouwmann Thanks for the answer. I think we got around 200 - 300 routes. I'll try to tell this to my boss and let him decide if he want to pursue it since there are some code that needed some refactoring in order to run it.

Thanks again

oroalej started a new conversation Performance Increase Of Route::cache • 2 months ago

Hi,

I would like to ask the performance increase of doingRoute::cache. Currently our system cannot do this since we got some code that have closures.

3rd August, 2018

oroalej started a new conversation Shortcut Of Where. • 2 months ago

Hi All,

If you would like to query like this

Modal::where('some_column', 'some value')->get();

You can code it this way.

Modal::whereSomeColumn('some value')->get();

The result will be the same.

Unfortunately, this will only work when you are looking for the equal value. It doesn't work with !=.

30th July, 2018

oroalej left a reply on Assign Dynamic Value To Variable • 2 months ago

Are you using laravel?

hmm.

maybe try this.

export default { 
  created() { 
    this.getUserCount()
  },
  data() {
    return {
      resultSet:{
        userCount: 0
      }
    }
  },
  methods: {
    getUserCount(){
      axios.get(this.globalUrl+'api/v1/dashboard') 
        .then(function (resp) { 
          this.resultSet = resp.data;
        })
        .catch(function (error) {
            console.log(error);
            alert("Could not load data");
        });
    }
  }
}

oroalej left a reply on A User Can Listen Only Twice Mp3 File On My Web...How To Do That? • 2 months ago

Whenever a user listen to a file, you record it to the database. then just check it using the date if user already reached the limit.

oroalej left a reply on Laravel Route Conflict • 2 months ago

move your search up like this way.


Route::get('/articles/search', '[email protected]')->name('articles.search');
Route::get('/articles/{article}', '[email protected]')->name('articles.show');

oroalej left a reply on Assign Dynamic Value To Variable • 2 months ago

What are you returning in your API? If you are returning the userCount value i think you should assign it this way.


this.resultSet['userCount'] = resp.data

24th July, 2018

oroalej left a reply on How To Add Link To Mail's Body • 2 months ago

@bobbybouwmann Thanks for the reply. I tried that but when i view it in the mail, it display the whole code. like <a href="my-url">Click me!</a>

After searching, the problem is that my code are indented. I don't know the reason why indent code render the code RAW.

oroalej started a new conversation How To Add Link To Mail's Body • 2 months ago

Hi,

I'm not familiar on how to create mail using the Mail module of laravel.

I was trying to add a link to the mail's body. However, the link was display as raw.

27th June, 2018

oroalej started a new conversation Got Format Invalid Error In A Japanese Character • 3 months ago

Hi,

How can i make the laravel validation accept japanese character? whenever I enter a japanese character in a field, it gives me the format invalid error.

Thank you

24th June, 2018

oroalej started a new conversation Confused On Eloquent Relationship • 3 months ago

Hi all,

I'm confused on where to place the HasMany or BelongsTo in the model.

I have a table named 1department1 and 1directory1, department can have multiple directory but directory can only have one department. I placed the foreign key in directory table. Now where do I place the belongsTo or hasMany?

I read an explanation in here regarding this where he use a head and a brain as an example but i cannot find it anymore.

23rd June, 2018

oroalej started a new conversation Laravel Pipeline In Gitlab • 4 months ago

Hi all,

I really don't have any idea nor experience on how to setup pipeline in gitlab. It is possible to make pipeline work in gitlab even though my project is only working on my local laptop? Do you have any guide for nubs on how to setup this pipelines?

Regards, Alex

12th June, 2018

oroalej started a new conversation Library For Point And Reward System. • 4 months ago

Can you guys recommend a point and reward system library for laravel if you know any.

We would like to add a point and reward system where a user will be rewarded with points whenever he/she answer a question and that point can be converted to something (reward).

oroalej left a reply on Laravel Datatable • 4 months ago

change your ajax to

  ajax: {
      url: route('teachers.data')
    },

Please make sure that you are calling the correct name.

you can check it using php artisan route:list --name=teachers.data

oroalej left a reply on How To Calculate The Total Likes Of All Posts Of A User • 4 months ago

Try using withCount.

you can read further in here

oroalej left a reply on How To Calculate The Total Likes Of All Posts Of A User • 4 months ago

request()->user()->withCount('postLike');

You should have a relationship with user and postLikes to make it work.

then laravel will create `post_like_count` column.

You can read further in (here)[https://laravel.com/docs/5.6/eloquent-relationships#counting-related-models]

11th June, 2018

oroalej left a reply on How To Create A New Function In Resource Controller In Laravel? • 4 months ago

create a function in the controller then add it in the route.

Route::get('purchase_detauls/newFunction', [email protected]');
Route::resource('Purchase_details','Purchase_detailsController');

or you can enclose it in Route::group

30th May, 2018

oroalej left a reply on How To Use V-for Index Inside Formcollective • 4 months ago

@click Thank you very much bro!

29th May, 2018

oroalej left a reply on How To Use V-for Index Inside Formcollective • 4 months ago

@bobbybouwmann I also tried using question[{{ index }}][answers][1] but it also doesn't work, it says undefined index. when I add @{{}}, it just printed out the whole {{ index }}

28th May, 2018

oroalej started a new conversation How To Use V-for Index Inside Formcollective • 4 months ago

Is it possible to use v-for index inside formcollective?

Here is an example:

      <div v-for="(question, index) in questions" style="margin-top: 20px">
          {{ Form::text('question[@{{index}}][answers][1]', null, ['class' => 'form-control']) }}

I want to add the index of v-for as the array index in the attribute name.

oroalej started a new conversation Is Request() Is Still Working When The Route Is Accessed Using Android? • 4 months ago

Hi,

We have an android application where the user can login, the problem is that it seems like the login is not going through or the request() doesn't return anything. But when I try checking the calls using Postman, everything is working fine.

25th May, 2018

oroalej left a reply on Need Tips On How To Handle Form Spam Submit • 4 months ago

@tomopongrac I already did that, is there any other way? because if the user disable the javascript or remove the disabled attribute using inspect, he can spam submit again.

@Snapey It's like an inquiry/messaging type of functionality. What captcha package can you recommend, /captcha or /no-captcha?

oroalej started a new conversation Need Tips On How To Handle Form Spam Submit • 4 months ago

Hi,

How can you guys handle form multiple submit / spam submit? I have a problem that when a user click the submit button repetitively, it will save in the database multiple times.

24th May, 2018

oroalej left a reply on How To Add Delay On @click To Prevent Multiple Click • 4 months ago

@m-rk Thanks bro.

oroalej started a new conversation How To Add Delay On @click To Prevent Multiple Click • 4 months ago

Hi,

The title say it all.

The @click is for a like button. I just want to prevent the double clicking.

21st May, 2018

oroalej left a reply on How To Get Client Ip Address In Register Controller In Laravel 5.3 With Passport Enabled • 5 months ago

You can also use request()->ip()

10th May, 2018

oroalej started a new conversation Purpose Of Builder Query • 5 months ago

Hi,

Just want to ask what is the purpose of Builder in

$model::when(condition, function(Builder $query){
    $query->someCondition;
})->get();

Because sometimes I get an error using it and by removing it fixed the issue.

6th May, 2018

oroalej started a new conversation Japanese Translation Of Validation • 5 months ago

Is there an existing japanese translation of laravel's validation?

30th April, 2018

oroalej left a reply on Auth Check Two Columns • 5 months ago

@tykus SPOT ON! thank you bro!

oroalej started a new conversation Auth Check Two Columns • 5 months ago

Is it possible to check two columns when authenticating? I would like to create a table with email and username columns whereas username is from the email address without the @gmail.com. and user can login using email or the username.

Really appreciate your help.

25th April, 2018

oroalej left a reply on Union With Pagination - Laravel 5.6 • 5 months ago

Hi guys,

I was able to make it in one query. But I still want to know how to make it work in case I encounter this problem in the future.

Thank you for your time @biishmar and @Agelios

oroalej left a reply on Union With Pagination - Laravel 5.6 • 5 months ago

@Agelios

Here is the code

  $featuredProfessionals = Professional::select('name', 'id')
                          ->WhereNotNull('matterport_url')
                          ->where('name', 'LIKE', "%{$search}%")
                          ->where('featured_ends_at', '>=', now());

  $professionals = Professional::select('name', 'id')
                        ->WhereNotNull('matterport_url')
                        ->where('name', 'LIKE', "%{$search}%")
                        ->union($featuredProfessionals)
                        ->latest()
                        ->paginate(5);

oroalej left a reply on Union With Pagination - Laravel 5.6 • 5 months ago

@Agelios I tried adding select to both queries, but it only works when I select 1 column. When I select 2 or more columns, the error showed up again.

@biishmar Like I said, it is working fine if I remove the ->union() code.

Sample code:

$first = Professionals::SomeConditions
                ->limit(5);

$second = Professional::SomeConditions
                    ->union($first) <<<--- If i remove this, everything is working fine.
                    ->paginate(5);
                    

$first = I'm trying to get only the featured professional where featured_date >= today.

$second = I'm trying to get the latest professional and combining the result with $first.

oroalej left a reply on Union With Pagination - Laravel 5.6 • 5 months ago

@biishmar Everything is working fine when I didn't use ->paginate(), but when I do, the error appear. It seems like paginate is not working with union. Is there any work around?

oroalej started a new conversation Union With Pagination - Laravel 5.6 • 5 months ago

Hi Guys,

How can I add pagination on a union. I got an error Cardinality Violationwhen using union with ->paginate().

20th April, 2018

oroalej started a new conversation Handle Sidebar State (If It Is Minimized Or Not) • 6 months ago

Hi guys,

What is the best way to handle the state of the sidebar? For example, if i minimized and refresh the page. the sidebar should be still minimized.

18th April, 2018

oroalej left a reply on Adding New Route To A Route:resource Returns Blank Page To The Route • 6 months ago

Try php artisan route:list to check if you are calling the right route.

oroalej started a new conversation Models Events • 6 months ago

Hi guys,

I'm trying to learn how we can manipulate the events on models. Can you give me any article/video that explain it clearly that is for free.

Really appreciate it. Thanks!

14th April, 2018

oroalej left a reply on How To Use Eloquent API Resource • 6 months ago

@bwrice oh, if I try to add it in my view just like this,

return view('someview', compact('$revision'); it will also not triggered the toArray() method?

oroalej left a reply on How To Use Eloquent API Resource • 6 months ago

@rin4ik What's the different that it will make? when I dd($blog) even when using the (Blogs $blog) it output the target blog.

oroalej started a new conversation How To Use Eloquent API Resource • 6 months ago

Hi Guys,

This is my first time using Resource and I really don't know how to use it. I'm stuck for hours trying to make it work so please help me.

Here is my sample code:

Controller:

public function edit(Blogs $blog)
{
  dd(new Revision($blog));
}

Resource:

use Illuminate\Http\Resources\Json\JsonResource;

class Revision extends JsonResource
{
    public function toArray($request)
    {
      return [
        ....
    'date_difference' => 'Some code'
      ];
    }
}

I'm just trying to output add the 'date_differencein the response but I couldn't make it. It seems likeBlogResource` didn't used at all.

11th April, 2018

oroalej left a reply on Find() Not Working Properly • 6 months ago

@Nash I found my issue, I added a ->get() at the end of the code. Modal::find($id)->get().

oroalej left a reply on Find() Not Working Properly • 6 months ago

@tisuchi yes, the id is the primary key of the table and it's an integer

@ztioge primary key is unique, so technically i'm just retrieving one item.

10th April, 2018

oroalej started a new conversation Find() Not Working Properly • 6 months ago

What would be the cause of ::find()to not work? it return all records in the table.

I tried using $model::where('id', '=', (int)$id) and it's working fine.

Is there any rules that we should follow in order for ::find() to function properly?

2nd April, 2018

oroalej left a reply on How To Call Function In An Extends Model • 6 months ago

@rumm.an Takes for pointing out. It seems like this code $files = $this->files->sortBy('width'); returns empty. Gonna test this part tomorrow and update you guys about this.

@Snapey I always saw you reply to problems, thanks for checking this issue.

The return statement I don't understand though... hmm.I'm also not sure about that. But is seems like if one of it is not empty, return the link else return empty string.

Edit Your Profile
Update

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