oroalej

oroalej

Member Since 10 Months Ago

Experience Points 3,620
Experience
Level
Lessons Completed 12
Lessons
Completed
Best Reply Awards 1
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    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.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

21 Oct
1 month ago

oroalej started a new conversation How To Use Laravel Request() Inside Vuejs

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

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. -_-

17 Oct
2 months ago

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

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([]);
    }

17 Sep
3 months ago

oroalej left a reply on Recommend Image Optimizer

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

13 Sep
3 months ago

oroalej started a new conversation Recommend Image Optimizer

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

09 Aug
4 months ago

oroalej left a reply on Performance Increase Of Route::cache

@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

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.

03 Aug
4 months ago

oroalej started a new conversation Shortcut Of Where.

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 !=.

30 Jul
4 months ago

oroalej left a reply on Assign Dynamic Value To Variable

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?

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

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

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

24 Jul
4 months ago

oroalej left a reply on How To Add Link To Mail's Body

@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

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.

27 Jun
5 months ago

oroalej started a new conversation Got Format Invalid Error In A Japanese Character

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

24 Jun
5 months ago

oroalej started a new conversation Confused On Eloquent Relationship

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.

23 Jun
5 months ago

oroalej started a new conversation Laravel Pipeline In Gitlab

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

12 Jun
6 months ago

oroalej started a new conversation Library For Point And Reward System.

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

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

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

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]

11 Jun
6 months ago

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

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

30 May
6 months ago

oroalej left a reply on How To Use V-for Index Inside Formcollective

@click Thank you very much bro!

29 May
6 months ago

oroalej left a reply on How To Use V-for Index Inside Formcollective

@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 }}

28 May
6 months ago

oroalej started a new conversation How To Use V-for Index Inside Formcollective

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?

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.

25 May
6 months ago

oroalej left a reply on Need Tips On How To Handle Form Spam Submit

@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

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.

24 May
6 months ago

oroalej started a new conversation How To Add Delay On @click To Prevent Multiple Click

Hi,

The title say it all.

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

21 May
6 months ago
10 May
7 months ago

oroalej started a new conversation Purpose Of Builder Query

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.

06 May
7 months ago

oroalej started a new conversation Japanese Translation Of Validation

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

30 Apr
7 months ago

oroalej left a reply on Auth Check Two Columns

@tykus SPOT ON! thank you bro!

oroalej started a new conversation Auth Check Two Columns

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.

25 Apr
7 months ago

oroalej left a reply on Union With Pagination - Laravel 5.6

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

@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

@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

@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

Hi Guys,

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

20 Apr
7 months ago

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

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.

18 Apr
8 months ago

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

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

oroalej started a new conversation Models Events

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!

14 Apr
8 months ago

oroalej left a reply on How To Use Eloquent API Resource

@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

@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

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.

11 Apr
8 months ago

oroalej left a reply on Find() Not Working Properly

@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

@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.

10 Apr
8 months ago

oroalej started a new conversation Find() Not Working Properly

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?

02 Apr
8 months ago

oroalej left a reply on How To Call Function In An Extends Model

@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.