vipin93

vipin93

Member Since 3 Years Ago

Varanasi

Self Coder at home

Experience Points 61,730
Experience
Level
Lessons Completed 25
Lessons
Completed
Best Reply Awards 61
Best Reply
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.

17 Sep
4 months ago

vipin93 left a reply on Laravel Snaapy This Site Can’t Be Reached?

Yes its because ssl don't use any secure script or css use only non ssl

19 Jun
7 months ago

vipin93 left a reply on Unable To See Broadcast Notification?

now after changing i successfully authenticate user in private chanel but still not able to broadcast notification

vipin93 started a new conversation Unable To See Broadcast Notification?

Hi I'm trying to implement laravel notification in my SPA which is in front end separate and backed in separate and I'm using socketio and redis but when I send a notifaction I'm unaable to see any log in my front end and I'm using laravel-echo-server

here is in my main.j

import Echo from "laravel-echo"
window.io = require('socket.io-client');
// Have this in case you stop running your laravel echo server
if (typeof io !== 'undefined') {
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':3000',
});
}

in my controller

$user->notify(new OfferRecived($created_offer));

and in my OfferRecived

public function toBroadcast($notifiable)
{
return new BroadcastMessage([
'data' => "addd"
]);
}

and in my client App.vue file

notificationsend(userId) {
console.log(userId);

Echo.channel('App.User.'+userId)
.notification((notification) => {
console.log(notification);
});
}
04 Jan
1 year ago

vipin93 started a new conversation Intended Not Working!

I'm trying to redirect my user dashboard according to role, but problem is that intended not working here I changed my LoginController

public function redirectPath()
{
// Logic that determines where to send the user
dd(\Session::get('url.intended'));
if (\Auth::user()->type == 'admin') {
return '/admin/dashboard';
}

return 'guest/dashboard';
}

and I also try to see url by dd but I'm getting null

dd(\Session::get('url.intended'));

I tried google and find similar problems but none of them works

01 Nov
1 year ago

vipin93 started a new conversation What I S The Best Table Strucure For Quiz Based App ?

i made for like , questions, questions_options, users, answerKEY now here is problem what i facing some issue some times a question have more questions somthing like group question

I tried to make somthing like this

here is questions table structure

31 Oct
1 year ago

vipin93 started a new conversation How To Select Max Array Object From Collection?

something I trying to make QUIZE system now problem is that i have answers table and its contains a section_id now I want select max correct answer group by user_id but also section_id now i have colection

[
{
"user_id": "24",
"section_id": "1",
"total": "5"
},
{
"user_id": "24",
"section_id": "2",
"total": "2"
},
{
"user_id": "24",
"section_id": "3",
"total": "2"
},
{
"user_id": "25",
"section_id": "2",
"total": "1"
},
{
"user_id": "25",
"section_id": "3",
"total": "1"
}
]

and my query here is

 $newmaxmarks = DB::table('question_answers')
                           ->whereRaw('answer_id = answerByUser')
                           ->select('user_id','section_id', DB::raw('count(*) as total'))
                           ->groupBy('user_id') 
                           ->groupBy('section_id')                
                           ->get(); 

now here i want something like

[
{
"user_id": "24",
"section_id": "1",
"total": "5"
},
{
"user_id": "24",
"section_id": "2",
"total": "2"
},
{
"user_id": "24",
"section_id": "3",
"total": "2"
}
]

27 Oct
1 year ago

vipin93 left a reply on Saving Form With Multiple Fieald Radio Button?

I solved by this


                    <form action="/save/answere" method="post">

                    {{ csrf_field() }}  

                       @foreach($questions as $question)

                        <input type="hidden" class="form-control" name="question[]" value="{{$question->id}}">
                        <h4>Question no: {{ $question->id }}</h4>
                        <h5>{{ $question->title }}</h5>
                        <span>{{ $question->description }}</span>                                
                        
                        @if($question->questiontype == "text")

                        <input id="answer" type="text" class="form-control" name="answer[{{$question->id}}]">
                        @else


                        @foreach($question->question_options as  $key => $question_option)

                           <label>
                                <input id="optradio" type="radio" name="optradio[{{$question->id}}]" 
                                    value="{{$question_option->id}}">
                                    {{$question_option->option_value}}
                                </input>
                           </label>

                        @endforeach

                        @endif
                        
                        @endforeach

                        <button type="submit">Submit<button>

                    </form>

vipin93 left a reply on Saving Form With Multiple Fieald Radio Button?

@mushood no I have form here is live view see http://fcf7ae80.ngrok.io/save/answere

and my saving method

$auth = \App\User::where('id',25)->first();

        foreach($r->question as $key => $value) {


            $data = [
                'question_id' => $value,
                'option_id'   => $r->optradio[$key],
                'answer'      => $r->answer[$key]
            ];

            $auth->questionansweres()->create($data);

        }

        return back();

vipin93 started a new conversation Saving Form With Multiple Fieald Radio Button?

I tried to save multiple fieald with included radio button, but problem is that I given radio name sotmhing like


<label>
          <input id="optradio[]" type="radio" name="optradio[]" value="{{$question_option->id}}">
       {{$question_option->option_value}}
    </input>
 </label>

so its treated as single group only one selected

here is my full form


 <form action="/save/answere" method="post">

                    {{ csrf_field() }}  

                       @foreach($questions as $question)

                        <input type="hidden" class="form-control" name="question[]" value="{{$question->id}}">
                        <h4>Question no: {{ $question->id }}</h4>                              
                        
                        @if($question->questiontype == "text")
                        <input id="answer" type="text" class="form-control" name="answer[]">
                        @else
                        <input id="answer" type="hidden" class="form-control" name="answer[]">
                        @endif 

                        @if($question->questiontype == "radio")
                        @foreach($question->question_options as $question_option)

                           <label>
                           <input id="optradio[]" type="radio" name="optradio[]" 
                             value="{{$question_option->id}}">
                             {{$question_option->option_value}}
                             </input>
                           </label>

                        @endforeach
                        @endif
                        @endforeach

                        <button type="submit">Submit<button>

                    </form>

15 Oct
1 year ago

vipin93 left a reply on Vuex Not Dispatching Store

i just removed

mounted () {
       this.$store.dispatch('setUserObject', null)
    },

and everything is fine

vipin93 left a reply on How Can Pass Props With Vue-router?

never mind yes I used props but I switch to vuex which much easier and its fast because I'm not calling another request

14 Oct
1 year ago

vipin93 left a reply on Vuex Not Dispatching Store

I tried to log

storeuser (value) {
      var some = this.$store.dispatch('setUserObject', value)
      console.log(some);
    }

I got error

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

vipin93 started a new conversation Vuex Not Dispatching Store

I tried to use Vuex to store user data but its seems like its not working in my one fo child component in other its working here is my method

export default {
  props: ['email','id'],
  data () {
    return {
      password: '',
      email1: this.email,
      confirm_password: '',
      errors: new Errors(),
      error: false,
      disablebutton: false,
      message: ''
    }
  },

  computed: {
      ...mapState({
        userStore: state => state.userStore
      })
    },

   mounted () {
       this.$store.dispatch('setUserObject', null)
    },

  methods: {
    onSubmit (e) {
      this.disable(e)
      axios.post('/auth/id_pass/'+ this.id + '/create',
      {
        password: this.password,
        email: this.email1,
        confirm_password: this.confirm_password
      }).then((response) => {
          this.storeuser(response.data.user)
          
          console.log(response.data.user);
      }).catch((error) => {
      });
    },

    storeuser(value) {
        this.$store.dispatch('setUserObject', value) //its not dispatching 
    }
  }

}

</script>

and here is my vuex

const state = {
  user: {}
}

const mutations = {
  SET_USER (state, userObj) {
    state.user = userObj
  }
}

const actions = {
  setUserObject: ({commit}, userObj) => {
    commit('SET_USER', userObj)
  }
}

export default {
  state,
  mutations,
  actions
}

but same thing I tried in another component its working fine like

methods: {
       fetchPost() {
            axios.get('/customer/' + this.id)
            .then((response) => {
              this.customer = response.data
              this.$store.dispatch('setUserObject', response.data.user) //here its dispatching 
            }).catch((error) => {
              console.log(error);
            });
     },

vipin93 left a reply on How Can Pass Props With Vue-router?

I try using push method

actionbutton (value) {
         this.$router.push({name: 'customeraction', params: {id:value.id}});
    }

now I want pass props "customer" how can pass this from this router my routes.js

{
      path: '/customer/:id/action',
      name: 'customeraction',
      component: require('./components/CustomerAction'),
      props: true

    },

vipin93 started a new conversation How Can Pass Props With Vue-router?

I tried to pass props data and in from parent to child components using vue router but when I clicked on my route in parent component my route only changed but my child component not open I want something like its open new view and I can use as back button to go back

here is my routes

      path: '/',
      component: require('./components/Home'),
      children: [
        {
            path: '/customer/:id/action',
          name: 'customeraction',
          component: require('./components/CustomerAction')
          }
      ]
    },```

here is my Home component

            <tr  v-for="(customer, index) in customers">

               <td>{{customer.name}}</td>
                 <router-link :to="{ name: 'customeraction', params: { id: customer.id }}">
                   <i class="fa fa-bars" aria-hidden="true"></i>
                 </router-link>
               </td>

             </tr>  //here I want click on this route so my new CustomerAction(component) should open but when I click nothing happen only my route change 
here is CustomerAction

{{ customer.email }} export default { props: ['customer'], } ```
09 Oct
1 year ago

vipin93 left a reply on Convert View To Pdf File

use Storage and laravel-snappy

28 Sep
1 year ago

vipin93 started a new conversation Hey How Can Use Guzzle Response Data ?

Hey I'm posting a post request for my api and getting data like this

{
"200": "OK",
"somdata": [
"Commercial versions of Word are licensed as a standalone product or as a component of Microsoft Office, Windows RT or the discontinued Microsoft Works suite."
]
}

now how can print only somdata

I tried something

echo($response['somdata'][0])

But its not working I know its just a basic question but I'm stuck

thanks

vipin93 started a new conversation Slack And Laravel Botman/botman Error?

Hey I'm trying to use laravel and Slack to make Bot I'm following this http://marcelpociot.de/blog/2016-10-19-write-your-own-slack-bot-using-laravel now prolem is that evry time when I try to veryfy my my challenge http://18ac9818.ngrok.io/slack its give me error

 "Your URL didn't respond with the value of the challenge parameter."

but I register route for this

Route::post('/slack', '[email protected]');
public function connect(Request $request) {

        $payload = $request->json();

        if ($payload->get('type') === 'url_verification') {

            return $payload->get('challenge');

        }
    }
```
I double checked everything was right but again and again I'm getting  that error 
26 Sep
1 year ago

vipin93 started a new conversation How Can I Access PDF File?

I'm trying to use https://github.com/spatie/pdf-to-text problem now I'm successfully able to upload file but I can not retrieve every time I'm getting error

2017-09-26 17:53:10] local.ERROR: could not find pdf E:\laragon\www\precilyl\storage.\.3KHzY2cOUkWyAuf0ziwIxqkS1n62QmNtaetzMwWv.pdf {"exception":"[object] (Spatie\\PdfToText\\Exceptions\\PdfNotFound(code: 0): could not find pdf 

here is my code

// $return = Storage::disk('local')->put('file.pdf', $request->filename);

    $filename = $request->file('filename')->store('');
    // $path = storage_path() . '\' . $name;
    // $file = Storage::get('app/'.$name);
    $return = \Spatie\PdfToText\Pdf::getText($filename, '/mingw64/bin/pdftotext');

     return $return;

22 Sep
1 year ago

vipin93 left a reply on How Can I Highlight Some Words From A Paragraph

mounted () {
    let cardTextList = document.querySelectorAll('.highlights-go-here');  
    cardTextList.forEach((element) => {
      let instance = new Mark(element);
      this.tagged.forEach((tagItem) => {
        instance.mark(tagItem.tag, {
          element: 'span',
          className: 'highlighted'
        });
      });
    });
  }

but problem with is that every time when My

  bots: [ {botwelcome: 'Good Morning!', bottrue: true}, {botwelcome: 'Please give some paragraph for summarizing. Please give some paragraph for summarizing', bottrue: false} ],///here when it updated my mounted not
      tagged: [{ tag: 'please' }] ///here when it updated my mounted not working 

vipin93 started a new conversation How Can I Highlight Some Words From A Paragraph

like here is my view

<div id="app">
  <v-app id="inspire">
    
    <template>
    <v-container grid-list-xl>
        <v-layout row wrap>
               <v-flex>
         <v-layout row wrap v-for="bot in bots">
            <v-card   
                            :class="{ 'green mt-2 xs7 sm7 md7 mt-2': bot.bottrue, 'purple xs7 offset-xs0 
                           offset-mg2 offset-lg5 mt-2 text-xs-righ': !bot.bottrue }">
                           <v-card-text v-html="bot.botwelcome.replace(/\b(here i want replace this from tagged array abject)\b/g, 
                            '<strong>$1</strong>')"> {{ bot.botwelcome }}</v-card-text>
              </v
                     </v-layout>
         </v-flex>      
        </v-layout>
    </v-container>
</template>
 
  </v-app>
</div>

new Vue({ el: '#app', data () { return { bots: [ {botwelcome: 'Good Morning!', bottrue: true}, {botwelcome: 'Please give some paragraph for summarizing. Please give some paragraph for summarizing', bottrue: false} ], tagged: [{ tag: 'please' }] ///here I want this to be highlighted } } })


I really do not getting idea how can do this should i use for loop

thanks  
12 Sep
1 year ago

vipin93 left a reply on How Can Print Index Value In V-text Or V-for?

problem is that How can add my response api data in my return

data () {
      return {
        valid: false,
        editing: false,
        apiresonse //here after submit button I want here to add api response bodytexts so that I can use 
      }
    },

vipin93 started a new conversation How Can Print Index Value In V-text Or V-for?

I'm trying to print value which I'm getting from my api but problem is that I'm getting it only in index format which I do not know how can I print

<template>
  <v-layout column justify-center>
    <v-card class="white--text" text-sm-center style="padding:10px;">
      <h4 class="text-sm-center">
        <div v-if="editing">
          Summary
        </div>
        <div v-else>
          Paste Paragraph
        </div>
    </h4>
      <v-layout row>
        <v-flex xs12>
          <div v-if="editing">
              <p  v-for="(item, index) in items">
              //here how can print response api value in on line 
              </p>
            <v-btn @click="back">back</v-btn>
          </div>
          <div v-else>
            <v-form  ref="form" v-model="valid">
              <v-text-field   v-model="body" name="body" rows="15"
              required textarea dark></v-text-field>
              <v-btn success class="elevation-0" @click="submit">Submit</v-btn>
              <v-btn @click="clear">clear</v-btn>
            </v-form>
          </div>
        </v-flex>
      </v-layout>
    </v-card>
  </v-layout>
</template>

<script>
  import axios from 'axios'
  function getbody (body) {
    var jsonData
    axios({
      method: 'post',
      url: 'http://api.foobar.com',
      data: (body),
      contentType: 'application/json',
      dataType: 'json',
      async: false,
      success: function (data) {
        jsonData = data
      }
    })
    return jsonData
  }
  export default {
    data () {
      return {
        valid: false,
        editing: false,
      }
    },
    methods: {
      submit () {
        var apiResponse = getbody({'body_text': this.body})
        var bodyfinal = apiResponse.bodytexts   ///here i want print bodytexts 
        this.editing = true
        this.body = summaryfinal
        console.log(apiResponse.bodytexts.length)
      },
      clear () {
        this.$refs.form.reset()
      },
      back () {
        this.editing = false
        this.body = ''
      }
    }

  }
</script>

api response I'm getting


  "200": "OK", 
  "bodytexts": [,...]
    [0]:"Word 2008, released on January 15, 2008, included a Ribbon-like feature, called the Elements Gallery, that can be used to select page layouts and insert custom diagrams and images.", 
    [1]:"Word 2011, released in October 2010, replaced the Elements Gallery in favor of a Ribbon user interface that is much more similar to Office for Windows,[40] and includes a full-screen mode that allows users to focus on reading and writing documents, and support for Office Web Apps.", 
    [2]:"[41]"
  


11 Sep
1 year ago

vipin93 started a new conversation How Can I Convert Jquery To Axios?

here is I try to convert this jquery ajax call jqery to axios but could not getting clue here is my code

chrome.runtime.onInstalled.addListener(function() {
  var body = "selection";
  var name = "jhone doe";
  var all_col = chrome.contextMenus.create({"name": name, "contexts":[body],"id": "context_selection"});  
});

var open_window_ids=[]

function getSummary(body_resp) {

    var body_data;

    $.ajax({
        url: 'http://mereac.dev/',
        type: 'POST',
        data: JSON.stringify(body_resp),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        async: false,
        success: function(data) {
            body_data = data;
        }
    });

    return body_data;
}
08 Sep
1 year ago

vipin93 left a reply on How Create Nested Relationship Over Three Models

and first you should check value availability if not available then print null or something like $products->some->nnnn or 'mesg'

vipin93 left a reply on Real Time Simulation (Web App And Phone App)

use pusher or socket.io

vipin93 left a reply on How Create Nested Relationship Over Three Models

try to use eager loading with('products.perr')..

06 Sep
1 year ago

vipin93 started a new conversation Its Look Like Laracasts.com Is Now A PWA Web App.

I just noticed that laracasts.com now a PWA web app. Its nice to see some series on PWA development. PWA a great alternative of mobile app.

29 Aug
1 year ago

vipin93 left a reply on Getting Data Between Two Dates

use first where clause then pluck

05 Aug
1 year ago

vipin93 started a new conversation Is Thee Any Libraries Or Tutorial To Make Real Time Vehicle Tracking Web App?

I'm building a web app for school, for tracking school bus I required to make real time tracking system with help of GPS and google map, I search a lot but could not find. if any one have experience please share some idea.(L5.4)

Thank you

25 Jul
1 year ago

vipin93 left a reply on Is It Possible To Integrate Biomatric Attedence System In Laravel?

can you give some idea are any blog post

vipin93 started a new conversation Is It Possible To Integrate Biomatric Attedence System In Laravel?

Now in my app a auth user fill day, entry time, leave time mannully, but i want to make automatic with biomatric. so it is possible?

17 Jul
1 year ago

vipin93 left a reply on Serialization Of 'Closure' Is Not Allowed?

@lars6 instead of job should i use event?

vipin93 started a new conversation Serialization Of 'Closure' Is Not Allowed?

I tried to dispatch job for my app but its giving me errors

Serialization of 'Closure' is not allowed

here is my in controller

dispatch(new AuthSendMessage($students,$r,$user));

and my AuthSendMessage

class AuthSendMessage implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

     protected $students;
     protected $r;
     protected $user;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($students,$r,$user)
    {
       
        $this->students      = $students;
         $this->r                  = $r;
         $this->user            = $user;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        foreach ($this->students as $student)
         {       
            $data = [
         
             'student_id'       => $student->id ,
             'teacher_id'       => null,
             'by_owner_id'   => Auth::id(),
             'by_teacher_id' => null,
             'message'          => $this->r->message

            ];

                $numbers[] = $student->emer_no; 
          
                $this->user->messages()->create($data);
         }
    }

16 Jul
1 year ago

vipin93 left a reply on How Can I Combine Two Objects?

I did like

$combine =  $timetables->merge($subjectnames);

and in view

@foreach($combine as $classe_section) {{ $i }} {{ $classe_section->courses['name'] }} {{ $classe_section->sections['name'] }}
                          @endforeach 
getting error 

Undefined index: name on line

{{ $classe_section->courses['name'] }} and when i try this {{ $classe_section->courses->name }}

Property [name] does not exist on this collection instance.

here is my $combine

[ { "id": 2, "user_id": 1, "name": "English", "remarks": null, "created_at": "2017-07-14 23:26:09", "updated_at": "2017-07-14 23:26:09" }, { "id": 3, "section_id": 1, "course_id": 2, "asession_id": 2, "user_id": 1, "start": "2017-07-16 07:40:00", "end": "2017-07-16 08:20:00", "created_at": "2017-07-16 00:38:54", "updated_at": "2017-07-16 00:38:54", "courses": { "id": 2, "user_id": 1, "name": "I", "remarks": null, "created_at": "2017-07-14 23:05:01", "updated_at": "2017-07-14 23:05:01" }, "sections": { "id": 1, "user_id": 1, "name": "A", "remarks": null, "created_at": "2017-07-14 23:25:51", "updated_at": "2017-07-14 23:25:51" } }, { "id": 1, "user_id": 1, "name": "Hindi", "remarks": null, "created_at": "2017-07-14 23:26:04", "updated_at": "2017-07-14 23:26:04" } ]


vipin93 started a new conversation How Can I Combine Two Objects?

I try to show some value using foreach loop but problem is that i have two objects and when i try to use in foreach loop its run 4 times 2+2 but i want only 2 times how can i combine them here is my code

 <tbody class="text-center">
                                 <?php $i = 0 ?>
                                @foreach($timetables as $classe_section)
                                 @foreach($subjectnames as $subject)
                                <?php $i++ ?>
                                <tr>
                                    <td>{{ $i }}</td>
                                    <td>{{ $classe_section->courses['name'] }}</td>
                                    <td>{{ $classe_section->sections['name'] }}</td>
                                    <td>{{ $subject['name'] }}</td>
                                    <td>
                                      @foreach($testnames as $testname)
                                        <a class="btn btn-primary" href="/teacher/student/{{$classe_section->courses['id']}}/{{$classe_section->sections['id']}}/{{$subject['id']}}/{{$testname['id']}}/test_amrks_upload">{{ $testname['name'] }}
                                        </a>
                                      @endforeach
                                    </td>
                                </tr>
                                @endforeach
                                @endforeach
                            </tbody>

here i want merge $timetables and $subjectnames

vipin93 started a new conversation How To Avoid Duplicate Foreign Key For Different Colmn Name?

I'm stuck with group by in my project , my problem is that i have table with 5 column name which stored foreign key value from one table now i want to group them by foreign key and if all column have same foreign key then show only one not all 5 time how can i do. here is my model and logic


      $timetables = TimeTable::where(function($q) use($userID,$activesessionidID){
                                      $q->where('user_id',$userID)
                                         ->where('asession_id',$activesessionidID);
                                   })->where(function($q){
                                      $q->orWhere('sunday_teacher_id',Auth::id())
                                         ->orWhere('monday_teacher_id',Auth::id())
                                         ->orWhere('tuesday_teacher_id',Auth::id())
                                         ->orWhere('wednesday_teacher_id',Auth::id())
                                         ->orWhere('thursday_teacher_id',Auth::id())
                                         ->orWhere('friday_teacher_id',Auth::id())
                                         ->orWhere('saturday_teacher_id',Auth::id());
                                   })->groupBy(['sunday_subject_id','monday_subject_id','tuesday_subject_id','wednesday_subject_id','thursday_subject_id','friday_subject_id','saturday_subject_id'])->get();

my time table model

   <?php

namespace App\Model\Staff\Acadmic;

use Illuminate\Database\Eloquent\Model;
use App\Model\Staff\Acadmic\TimeTable;
use Carbon\Carbon;
use App\Model\Day;
use App\Subject;
use App\Teacher;
use App\User;
use App\Course;
use App\Section;
use App\Asession;

class TimeTable extends Model
{
 
  
    protected $fillable = [
       'start','end','asession_id','section_id','course_id','sunday_subject_id','sunday_teacher_id','monday_subject_id','monday_teacher_id','tuesday_subject_id','tuesday_teacher_id','wednesday_subject_id','wednesday_teacher_id','thursday_subject_id','thursday_teacher_id','friday_subject_id','friday_teacher_id','saturday_subject_id','saturday_teacher_id','sunday_remarks', 'monday_remarks' ,'tuesday_remarks','wednesday_remarks' ,'thursday_remarks' ,'friday_remarks', 'saturday_remarks'
    ];
     //'break_start','break_end',
     protected $dates = ['start','end'];


     public function setStartAttribute($value)
    {
        
        $this->attributes['start'] = Carbon::createFromFormat('g:i A',$value);
    }

    public function setEndAttribute($value)
    {
         
        $this->attributes['end'] = Carbon::createFromFormat('g:i A',$value);
    }

    public function sundaysubjects()
    {
        return $this->belongsTo(Subject::class,'sunday_subject_id');
    }

    public function sundayteachers()
    {
        return $this->belongsTo(Teacher::class,'sunday_teacher_id');
    }

    public function mondaysubjects()
    {
        return $this->belongsTo(Subject::class,'monday_subject_id');
    }

    public function mondayteachers()
    {
        return $this->belongsTo(Teacher::class,'monday_teacher_id');
    }

    public function tuesdaysubjects()
    {
        return $this->belongsTo(Subject::class,'tuesday_subject_id');
    }

    public function tuesdayteachers()
    {
        return $this->belongsTo(Teacher::class,'tuesday_teacher_id');
    }

    public function wednesdaysubjects()
    {
        return $this->belongsTo(Subject::class,'wednesday_subject_id');
    }

    public function wednesdayteachers()
    {
        return $this->belongsTo(Teacher::class,'wednesday_teacher_id');
    }

    public function thursdaysubjects()
    {
        return $this->belongsTo(Subject::class,'thursday_subject_id');
    }

    public function thursdayteachers()
    {
        return $this->belongsTo(Teacher::class,'thursday_teacher_id');
    }

    public function fridaysubjects()
    {
        return $this->belongsTo(Subject::class,'friday_subject_id');
    }

    public function fridayteachers()
    {
        return $this->belongsTo(Teacher::class,'friday_teacher_id');
    }

    public function saturdaysubjects()
    {
        return $this->belongsTo(Subject::class,'saturday_subject_id');
    }

    public function saturdayteachers()
    {
        return $this->belongsTo(Teacher::class,'saturday_teacher_id');
    }



    public function sections()
    {
        return $this->belongsTo(Section::class,'section_id');
    }

    public function courses()
    {
        return $this->belongsTo(Course::class,'course_id');
    }

    public function asessions()
    {
        return $this->belongsTo(Asession::class,'asession_id');
    }

     public function users()
    {
        return $this->belongsTo(User::class,'user_id');
    }
}
05 Jul
1 year ago

vipin93 started a new conversation How Can I Generate Unique And Random Combination?

I'm try to generate time table of school which should random and unique combination of some value like I have value in database combination of teacher, class, section,subject now i want time table will generate combination of

day time teacher subject

for particular class and section

please give some guide, I'have no clue thanks

03 Jul
1 year ago

vipin93 started a new conversation CURL Error 7: Failed To Connect To Api.mailgun.net

I'm try to use Bogardo/Mailgun to use for my newsletter email sending but when I try to send simple email its throwing error

cURL error 7: Failed to connect to api.mailgun.net port 80: Timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
23 Jun
1 year ago

vipin93 started a new conversation Dropdown Not Working?

I'm using datatables for my database record but when i'm added js file of datatables my menu dropdown not working when i removed my dropdown file my dropdown working .

like my main layout file

<script src="/js/app.js"></script> 
      @yield('script')
  </body>

and my page where i'm using script

@section('script')
<script type="text/javascript" src="{{asset('/js/datatables.min.js')}}" ></script>
<script src="{{asset('/vendor/datatables/buttons.server-side.js')}}"></script>
.....
...
@stop 

here when i removed

<script type="text/javascript" src="{{asset('/js/datatables.min.js')}}" ></script>
<script src="{{asset('/vendor/datatables/buttons.server-side.js')}}"></script>

my dropdown working thanks

19 Jun
1 year ago

vipin93 left a reply on How To Order By In Eloquent Relationships?

use eager load with where clause

14 Jun
1 year ago

vipin93 started a new conversation How Can I Combine This Query?

 $hostel_fee = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('hostel_fee'); 
 $hostel_fee_late = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('late_fee');

$hostel_fee_other = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('other_fee');

10 Jun
1 year ago

vipin93 left a reply on Why I'm Not Getting Expected Value?

@mushood problem solved its about order first AND Then OR

@Snapey

Can you see the mysql log?

I did not get this

vipin93 started a new conversation Why I'm Not Getting Expected Value?

I try to fetch users who have subscription created month is equal to current last month but its giving all users here is my function (I have to user only id 1, and 2


        //$lastmonth = Carbon::now()->subMonth(1)->month; 

        $users = User::where('active',1)->where('plan','!=',0)->orWhere('plan',1)
                        ->orWhere('plan',2)->whereHas('subscriptions',function($q){
                            $q->whereMonth('created_at',5');
                        })->select('id')->get();
       return $users;

and output

[
{
"id": 1
},
{
"id": 2
}
]

and here is my subscriptions table ( https://ibb.co/jKFGtF)

vipin93 left a reply on How To Show Data Of Other Table For Current Auth User..?

if ur problem solved then marked best answer so that it help to other