MyirLik

Member Since 6 Months Ago

Experience Points
1,750
Total
Experience

3,250 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 1
1,750 XP
Feb
15
1 month ago
Activity icon

Replied to How To Make A Service Class And And Call It In The Controller

I get an error, the funtions don`t exist

Feb
14
1 month ago
Activity icon

Replied to How To Make A Service Class And And Call It In The Controller

I don't really understand how to do this injection and the service class.

Activity icon

Started a new Conversation How To Make A Service Class And And Call It In The Controller

Hi, how can I do a service and call that service in the controller without having so much code in the controller? For example, to move this code to a service and to call it depending on what I ask for on the route Controller code

public function convert(Request $request) {
        switch($request->query('source')) {
            case '1':
                $csv = Reader::createFromPath('');
                $csv = $csv->setOffset(1);
                $json = json_encode($csv, JSON_PRETTY_PRINT);
                return response($json);
            break;
            case '2':
                $data = DB::table('transactions')->get();
                $json = json_encode($data, JSON_PRETTY_PRINT);
                return response($json);
            break;
            default:
                $error = array(
                    'status' => 'error',
                    'message' => 'Error'
                );
                return response()->json($error, 400);
        }
    }

So I have this code in the controller. How can I write this code in a service and call that service when the route is 1 or 2?

Feb
12
2 months ago
Activity icon

Started a new Conversation Convert Actually Code To Resfull Api

Hi, I have the initial code and I would like to simplify it in some restful api with parameter in the route. E.g: I would like the controller to validate what I take from the route, send it to a factory and return the csv or what I have in the database. Forget the original code

public function convert($type) {
        switch($type) {
            case 'csv':
                $csv = Reader::createFromPath(');
                $csv = $csv->setOffset(1);
                $json = json_encode($csv, JSON_PRETTY_PRINT);
                return response($json);
            break;
            case 'db':
                $data = DB::table('transactions')->get();
                $json = json_encode($data, JSON_PRETTY_PRINT);
                return response($json);
            break;
            default:
                $error = array(
                    'status' => 'error',
                    'message' => 'Error'
                );
                return response()->json($error, 500);
        }
    }
Route::get('convert/{type}', 'App\Http\Controllers\[email protected]');
And I would like for example to give a parameter of the route and to receive what I have and to check only in the controller and to take the rest from the factory
For exemple
Route::get('convert/source=?{type})'

Feb
02
2 months ago
Activity icon

Replied to Count Same Data And Show One Javascript

Thanks, but like this only helps me in the console, how could I hide the double value in the view? I used to do it in that for loop

If a value is twice
divs.display.style = 'none'
Feb
01
2 months ago
Activity icon

Replied to Count Same Data And Show One Javascript

Yes, but set put my values like ['1', '2', '3']

(5) ["2", "7", "-", "1", "0"]
1:937 (5) ["1", "3", "-", "2", "0"]
1:937 (4) ["0", "2", "-", "1"]
1:937 (5) ["1", "5", "-", "2", "0"]
1:937 (5) ["2", "8", "-", "1", "0"]

And this show me divs.forEach is not a function

Activity icon

Replied to Count Same Data And Show One Javascript

 var divs = document.getElementsByClassName('test');
    var result = 0;
    for (var i = 0; i < divs.length; i ++) {
        divs[i].getAttribute('data-content');
        let arr = [];
        arr = divs[i].getAttribute('data-content');
        arr.sort();
        
    }

I tried to put everything in an array to sort them and cancel the duplicates but it gives me sort is not a function. It should be mentioned that I have such values 27-10-2020, 28-10-2020 etc

Activity icon

Started a new Conversation Count Same Data And Show One Javascript

Hi, I took this data from the date-attributes and for example I have data-content that contains the date of a day. For example, I would like divs that have the same date from the same day to display only one value. How can I count values ​​of the same kind?

var divs = document.getElementsByClassName('test');
    var result = 0;
    for (var i = 0; i < divs.length; i ++) {
        divs[i].getAttribute('data-content');
    
        console.log(divs[i].getAttribute('data-content'))
    }

For example: Output: 22-01-2021 22-01-2021 > 2 value (show one)

From console
12-01-2021
08-10-2020
19-11-2020
21-01-2021
24-10-2020 - {
						 => show one 
24-10-2020 - { 

I hope I was explicit

Jan
28
2 months ago
Activity icon

Started a new Conversation Display Of New Data Without Refresh Laravel + Vue

Hello, How can I view the data after a post request without refreshing? Forget how I got the initial code. As far as I know I should add a response in axios.post and refresh the data, but how could I do that?

data() {
            return {
              qualifying:[],
     
            }
        },

addQualifying(id) {
               axios.post('qualifying/' + id)
                    
            }
Jan
27
2 months ago
Activity icon

Started a new Conversation Hide The Div If The Date Is The Same On Two Divs

<button type="button" class="btn btn-default color_green" data-container="body" data-toggle="popover" data-placement="bottom" data-content="23-10-2020" data-original-title="" title="" style="display: inline;">
                                                    Something
                                                </button>
<button type="button" class="btn btn-default color_green" data-container="body" data-toggle="popover" data-placement="bottom" data-content="23-10-2020" data-original-title="" title="" style="display: inline;">
                                                    Something
                                                </button>

Hi, I have this button for example, and I would like to take over in a variable after data-content = "23-10-2020" for example and hide if one if two dates are of the same type

<script>
    let divs = document.getElementsByClassName('btn btn-default color_green');
    for(let i = 0; i < divs.length; i++){
        console.log(i);
        if(i % 2 === 0) {
            divs[i].style.display = 'inline';
        } else {
            //divs[i].remove();
            divs[i].style.display = 'none';
           
        }
        
    }
</script>

I had tried to do this if there are two buttons, but I would like to date, how can I proceed?

Jan
25
2 months ago
Activity icon

Replied to Http 500 Error When I Try Post Request

{message: "Trying to get property 'votes' of non-object", exception: "ErrorException",…}
exception: "ErrorException"
file: "C:\xampp\htdocs\Questionnaire-Project\app\Http\Controllers\QuestionController.php"
line: 51
message: "Trying to get property 'votes' of non-object"
trace: [,…]
0: {file: "C:\xampp\htdocs\Questionnaire-Project\app\Http\Controllers\QuestionController.php", line: 51,…}
1: {function: "vote", class: "App\Http\Controllers\QuestionController", type: "->"}
2: {,…}
3: {,…}
class: "Illuminate\Routing\Controller"
file: "C:\xampp\htdocs\Questionnaire-Project\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php"
function: "callAction"
line: 45
type: "->"
4: {,…}
class: "Illuminate\Routing\ControllerDispatcher"
file: "C:\xampp\htdocs\Questionnaire-Project\vendor\laravel\framework\src\Illuminate\Routing\Route.php"
function: "dispatch"
line: 239
type: "->"
Activity icon

Replied to Http 500 Error When I Try Post Request

I have debugged but nothing is displayed. I simply have that function in the Controller to increment a number and the part of the route that is set for the station. And in vue js I have the data part and methods where I take the data and I would like to send it.

 <li v-for="question in questions" :key="question.id" class="list-group-item">
            {{ question.questiontype }}
        <br>
        <button v-on:click="addVote(question.id)">Add 1</button>
        <br>
        <span class="badge badge-primary"><strong>{{ question.votes }}</strong></span>
        </li>
data() {
            return {
              questions:[],
              percentages:[],
              vote: '',
            }
        },
        methods: {
            getQuestions(){
                axios.get('/api/questionlist')
                    .then((response)=>{
                       this.questions = response.data.question
                    })
            },
            getPercentages(){
                axios.get('/api/getpercentage')
                    .then((response)=>{
                       this.percentages = response.data.percentage
                    })
            },
            addVote(id) {
                axios.post('api/vote', {id:id})
            }
        },
        created() {
            this.getQuestions(),
            this.getPercentages(),
        }
Activity icon

Started a new Conversation Http 500 Error When I Try Post Request

I asked again last night, but I think I did it in the wrong category. So I started learning Laravel + Vue but I wake up with a problem on the post request side. Let me show you how to proceed

 data() {
            return {
              questions:[],
              percentages:[],
              vote: ''
            }
        },
methods: {
addVote(id) {
                axios.post('api/vote', {id : id})
            }
}
Controller:
public function vote(Request $request, $id) {
		$question = Question::find($id);
		if(Auth::user()->votes == 0) {
			$question->increment('votes', 1);
			$question->increment('totalvotes', 1);
			Auth::user()->update([
				'votes' => '1'
			]);
			Alert::success("Success", 'Your vote has been added');
        }
        return response()->json([
            'message' => 'OK'
        ]);
    }
Route
Route::POST('/vote', '[email protected]');

So I really don't understand what I'm doing wrong in this whole process

Jan
24
2 months ago
Activity icon

Replied to Post With Laravel And Vue.js

And in the post response should I put a redirect or an alert? Because in the display, I just put that I take that data

Jan
23
2 months ago
Activity icon

Started a new Conversation Post With Laravel And Vue.js

Hi, I recently started learning vue js with laravel. I managed to retrieve the data with get but how could I send data based on id in vue and laravel? Forget how I proceeded for the fasting part.

route
Route::POST('/vote/{id}',          '[email protected]');
Controller
 public function vote($id) {
		$question = Question::find($id);
		if(Auth::user()->votes == 0) {
			$question->increment('votes', 1);
			$question->increment('totalvotes', 1);
			Auth::user()->update([
				'votes' => '1'
			]);
			Alert::success("Success", 'Your vote has been added');
        }
        return response()->json($question);
    }

 <li v-for="question in questions" :key="question.id" class="list-group-item">
            {{ question.questiontype }}
        <br>
        <button  onClick="addVote()" class="badge badge-primary">Vote</a>

data() {
            return {
              questions:[],
              percentages:[],
	      vote = '' 
            }
        },
        methods: {
            getQuestions(){
                axios.get('/questionlist')
                    .then((response)=>{
                       this.questions = response.data.question
                    })
            },
            getPercentages(){
                axios.get('/getpercentage')
                    .then((response)=>{
                       this.percentages = response.data.percentage
                    })
            },
	  addVote(){
		axios.post('')
		}	
        },
        created() {
            this.getQuestions(),
            this.getPercentages()
        }

But at the post in view I got stuck ... How can I proceed?

Jan
22
2 months ago
Activity icon

Replied to Display None For A Span In A Div

Not work...


#main > span.promotion {
display: none;
}

<div class="main">
	<div class="proditem">
	

	<div class="proditem_cover">
		<a href="" title=" " alt=" "></a>
		<span class="promotion">Test: Test</span>
	</div>
</div>
</div>
			
Activity icon

Started a new Conversation Display None For A Span In A Div

Hello, I have a div with the "main" class and in this div I have a span with the "promotion" class. My question is: When I use this type in css, that span is not hidden. How should I do otherwise?

#main > .promotion {
    visibility:none;
}
Jan
12
3 months ago
Activity icon

Started a new Conversation Application For Appointments

Hi, I researched more but I can't find a good solution. I wish I had that. A calendar in which the date starts from January 1 until the end of the year. So far nothing difficult. But, how could I set an interval of n minutes in the database for each time of the day? I mean, I want to make a scheduling application, and apply a 10-minute interval every hour of that day. What would be the best and best method in laravel?

Schema DB
   $table->increments('id');
            $table->timestamp('start')->nullable();
            $table->timestamp('end')->nullable();
            $table->text('description')->nullable();
	    $table->unsignedInteger('service_id');
            $table->foreign('service_id')->references('id')->on('services');
service_id 
it will be the id of the place where you can make the appointment and I would like to set it to 10 minutes.
What do I want to understand, how could I use intervals and what conditions could I set?
e.g
for today
if (today == dateFromDb)?

Where today I want it to have the interval and the date today and to be equal to the interval in db
Jan
10
3 months ago
Activity icon

Started a new Conversation Call To Undefined Method Illuminate\Database\Query\Builder::replicating()

Call to undefined method Illuminate\Database\Query\Builder::replicating() i tried to update my laravel project from 5.3 to 7 and i get this error. What are be the problem?

#0 C:\xampp\htdocs\src\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(1286): Illuminate\Database\Query\Builder->__call('replicating', Array)
#1 C:\xampp\htdocs\src\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1477): Illuminate\Database\Eloquent\Builder->__call('replicating', Array)
#2 C:\xampp\htdocs\src\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1489): Illuminate\Database\Eloquent\Model->__call('replicating', Array)
#3 C:\xampp\htdocs\src\vendor\kingofcode\laravel-uploadable\src\Uploadable.php(35): Illuminate\Database\Eloquent\Model::__callStatic('replicating', Array)
#4 [internal function]: LaravelProject\Models\User::bootUploadable()
Jan
09
3 months ago
Activity icon

Started a new Conversation Calendar For A Years With Intervals Laravel.

Hi, how can I make a calendar in view and insert directly for the whole year except Saturday / Sunday an interval of hours? How would it be easier for example? Is there a bookstore like this or can I do it in an easier way? I would like to have a table for example: ID, date_and_hours, checked (boolean) And to have the interval and the dates for the whole year. something like this https://youtu.be/Z9aZJ9scxNg?t=129

Oct
20
5 months ago
Activity icon

Replied to Send If Is Checked

This will automatically send the form when I use submit, I would like it to show me an error when I click submit and it is not checked

Oct
19
5 months ago
Activity icon

Started a new Conversation Send If Is Checked

How can I write a function in javascript so that when I checked the checkbox the form will send in case an error does not occur and is not sent?



      <div class="col-md-4 col-xs-6" style="width: 100%;"><input 

        style="background-color: #FF0000 !important;
    padding: 5px 15px !important;  margin-top: 20px;
    float: right; 
    border-radius: 10px;
    border: none;
    font-size: 15px !Important;
    box-shadow: 2px 2px 2px #acacac;
    color: #fff !important;" 
    name="send" id="forms-send" type="submit" value="<?=$this->lang->line('form.send'); ?>" ></div>
    </div>
    <input type="checkbox" id="myCheck" onclick="isChecked()">
Activity icon

Started a new Conversation Jquery Performance

How can I get rid of jquery and replace it with something else? With him in the ligthhouse I get a very low score and without him a super high score. Is there a way to optimize this?

Activity icon

Replied to Eliminate Render-blocking Resources

I try but style doesn`t load

Oct
16
5 months ago
Activity icon

Started a new Conversation Eliminate Render-blocking Resources

How can i solve this? This is my css links


        <link href="_css/styles.css"  rel="stylesheet" type="text/css" />
	<link rel="alternate" type="application/rss+xml" title="DD" href="<?php echo base_url() ?>rss/">
	<link href="fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css"/>
	<link href="_css/bxslider.css" rel="stylesheet" type="text/css" />
	<link href="_css/bootstrap.css" rel="stylesheet" type="text/css" />
	<link href="_css/fotorama.css" rel="stylesheet" type="text/css" />
	<link href="_css/featherlight.min.css" rel="stylesheet" type="text/css" />

Fixed in this order

Oct
13
6 months ago
Activity icon

Replied to Php Files Won`t Load

Exist. i copy text from web page

Activity icon

Replied to Php Files Won`t Load


isMobile() ? ($detect->isTablet() ? 'tablet' : 'mobile') : 'desktop'); #if (isset($_COOKIE["cookiename"])) echo "aaa"; if($layout=='desktop' || isset($_COOKIE["mobilec"])) include('app/index.php');

displays what's in the file, if it's a php function it doesn't load This is exactly what it displays on the web page

Activity icon

Replied to Php Files Won`t Load

in htdocs. Php project without any frameworks

Activity icon

Replied to Php Files Won`t Load

No. not load

Oct
12
6 months ago
Activity icon

Started a new Conversation Php Files Won`t Load

Hi, do you know why php files don't start? I haven't suffered so far. I also made a .php test file in which I gave a simple echo and it doesn't display anything. Do you have any ideas? I use Windows as an operating system, php 7.4. Is it possible because of the hosts file? I was using the docker and I needed it. If I want to use laravel, everything works perfectly but not on a simple php file. Do you have any ideas?