mac03733

mac03733

Member Since 5 Months Ago

Experience Points 2,980
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 2
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.

30 Nov
1 week ago

mac03733 left a reply on How To Find Number Of Mondays (or Any Particular Day) In A Month?

HERE IS A QUICK SOLUTION ..there are probably cleaner ways ...but this works perfectly

function numberofDays($dayName,  $monthName, $year ){

//$dayName = "monday";
//$monthName = "december";
//$year = "2018";

$month_number = date("m",strtotime($monthName)); //converts the month to a number
$numberOfDays=0;
  
 $month_day_in = date("m", strtotime("first ".$dayName." ".$year."-".$month_number));
if($month_day_in == $month_number){  //check if the following $dayName is in $monthName 
  
 $numberOfDays++;
}

 $month_day_in = date("m", strtotime("second ".$dayName." ".$year."-".$month_number));
if($month_day_in == $month_number){
  
  $numberOfDays++;
}

 $month_day_in = date("m", strtotime("third ".$dayName." ".$year."-".$month_number));
if($month_day_in == $month_number){  
  
  $numberOfDays++;
}

 $month_day_in = date("m", strtotime("fourth ".$dayName." ".$year."-".$month_number));
if($month_day_in == $month_number){
  
  $numberOfDays++;
}

 $month_day_in = date("m", strtotime("fifth ".$dayName." ".$year."-".$month_number));
if($month_day_in == $month_number){  
  $numberOfDays++;
}

    return $numberOfDays;
}

mac03733 left a reply on Issue With Gitignore When Pushing Laravel Site To Server

on your server ..try running the following command

php artisan storage:link

then try upload

29 Nov
1 week ago

mac03733 left a reply on How Do You Deploy Your Laravel Project To Your Self Hosted Server?

THE ANSWER TO YOUR IS QUESTION DEFINITELY HERE

--> https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/

what u are looking for starts at STEP 11

but u can consider reading the other steps just for better understanding of th setup

mac03733 left a reply on Laravel Style File

i would be helpful if u showed some code on how u implemented this ...

have you tried running

npm run dev

assuming you imported ur styles file into app.scss

28 Nov
1 week ago

mac03733 started a new conversation Charts And Graphs

can anyone recommend a way or best package to implement graphs or charts in laravel .

05 Nov
1 month ago

mac03733 started a new conversation Calendar Show Events Based On DB ( RECOMMEND)

can someone recommend an easy to implement but good calendar that can allow me to show events on th calendar based on dates from the database

01 Nov
1 month ago

mac03733 left a reply on Need To Learn Date Range Filter In Laravel

#####so which date picker is recommended !

22 Oct
1 month ago

mac03733 left a reply on Server Concern "Digital Ocean"

@click

and create a "snapshot" of your server before you do this. This way you can easily switch back to the previous settings if something does fail and you are unable to fix or rollback it in short time.

ya ill definitely look into that ..sounds handy

mac03733 started a new conversation Server Concern "Digital Ocean"

i have a digital ocean droplet ..and every time i log onto it there is always an update was wondering if it is really necessary for me to keep updating it .or if there is a way this can just be make automatic ..or perhaps someone could point me to a good serve management tutorial

thanks

18 Oct
1 month ago

mac03733 left a reply on What Am I Doing Wrong? Arrrgggh Trying To Get Property Of Non-object

try this ...

UserController

public function show(User $user)
    {
        return view('user')->with('user',$user);
    }
15 Oct
1 month ago
04 Oct
2 months ago

mac03733 left a reply on Get Records From Db BUT Without Repeating A Specific Column

solutions i ended up with

$users = DB::table('users')
        ->select('id','name', 'email')
        ->get();

foreach($users->unique('name') as $user){
  //....
}

or

$users = User::groupBy('name')->get();
       

mac03733 left a reply on Get Records From Db BUT Without Repeating A Specific Column

@petritr the structure of the DB is perfect ..i expect it to repeat the value. what i need help with is wat i stated in the question

please let me know in case the question is not clear , THANK 4 attempt though

mac03733 left a reply on [Vue Warn]: Unknown Custom Element: <example-component> - Did You Register The Component Correctly?

and go to where u import your app.js ...if there is a defer attribute on the script tag .remove the "defer" ..

recompile and test

mac03733 left a reply on [Vue Warn]: Unknown Custom Element: <example-component> - Did You Register The Component Correctly?

can u also check your browser console and see if there is any message

mac03733 started a new conversation Get Records From Db BUT Without Repeating A Specific Column

is there some fancy laravel / eloquent way of doing what th question states.

assuming i have a column named 'bluh' , if "bluh" has a reapeating value accross other rows ..only get one

27 Sep
2 months ago

mac03733 left a reply on {{ __('web.name') }} Syntax ?

does the "web." point to some file or smothing

mac03733 started a new conversation {{ __('web.name') }} Syntax ?

can someone tell me what that syntax implies /or does

12 Sep
2 months ago

mac03733 left a reply on How To Use Registration Form For Two Tables

@Sergiu17 .. i was just passing by ...like the way u answer ... please keep it up

03 Sep
3 months ago

mac03733 left a reply on Inserting Values Into Foreign Key Table And Primary Key Table

have u considered doing it this way

  1. this line , u can remove it
$table->foreign('thief_id')->references('id')->on('thieves');

then in Thieves model hav somthing like

public function cars(){
    return $this->hasMany('App\Car');
}

then in cars model add somthing like

public function cars(){
    return $this->belongsTo('App\Thief');
}

then when u save a car u can give it the primary key of the thief as a foriegn key

you can look add laravel relasionship documentation for bettter understanding

Hope that helps

30 Aug
3 months ago

mac03733 left a reply on Vhost ?? Php Artisan Serve ????

so are there specific projects that require

php artisan serve

because i only started using it when i cloned a project and all it showed was a blank page when i try

127.0.0.1/appfolder/public

but worked whn i used

php artisan serve

mac03733 started a new conversation Vhost ?? Php Artisan Serve ????

wat is need for using ... vhost or php artisan serve . so far i have just been using 127.0.0.1/appfolder/public

am on laravel5.6 and using xamp

29 Aug
3 months ago

mac03733 started a new conversation Laravel5.6 + Vue + Vuex + Vue-router

hi ..i just started learning laravel about 2 months back .. and now i need to combine with vue + vuex + vue-router ..can someone recommend material or a good tutorial implementing all those in laravel ..

thank you.. nd love the support newbies get from this community .. really makes the learning easier

mac03733 left a reply on Create A New Table Or Store In Same

i would go for one table. My reasoning being you dont hav to query multiple tables if u need data about several states and its much easier to manage

hope i understood ur question nd the answer is helpful

24 Aug
3 months ago

mac03733 left a reply on Laravel 5.6 + Materialize | Mdbootstrap Without Removing Bootstrap 4

i know the question might sound silly to those of you used to this .. but can i please get some help ..THANK U

mac03733 started a new conversation Laravel 5.6 + Materialize | Mdbootstrap Without Removing Bootstrap 4

hi guys, newbie here ... am trying to start using material design for my projects .. for some reason its not as easy as i thought it would be. can someone please advice on how to setup materialize without having to remove bootstrap preferably using npm

as a side question ..which would u recommend materialize vs mdbootstrap

23 Aug
3 months ago

mac03733 left a reply on What To Do After NPM ?

@tykus thanks... i only used the first import.and it works ............ to avoid asking again the next time i do an npm install

is it basically the same set of steps for everything ...

for example assuming i do something like

npm install datatable

mac03733 started a new conversation What To Do After NPM ?

already feeling silly as i ask this question ..

i just ran "on laravel 5.6"

npm install mdbootstrap

now what do i need to do to be able to start using it use it..

22 Aug
3 months ago

mac03733 left a reply on No Debug Page ( Debug Is True )

Sweet .. php artisan config:clear solved it . thanks for the help guys

21 Aug
3 months ago

mac03733 left a reply on No Debug Page ( Debug Is True )

@Talinon ...will give that a try... lol ... didnt spot that...thanks for pointing it out

mac03733 left a reply on No Debug Page ( Debug Is True )

.env

APP_DEBUG=true

app.php

'debug' => env('APP_DEBUG', false),

mac03733 left a reply on No Debug Page ( Debug Is True )

@Snapey config('app.debug') returns false .but when i check it both files its set to true.

i already ran cache:clear command ..still getting the same results

mac03733 left a reply on No Debug Page ( Debug Is True )

@Nash i already cleared th cache ...and iv tried changing it in both th app.php and the .env

20 Aug
3 months ago

mac03733 left a reply on No Debug Page ( Debug Is True )

@Talinon i already have 775 permission recursively applied to storage

mac03733 started a new conversation No Debug Page ( Debug Is True )

hi .. i keep getting "Whoops, looks like something went wrong." even tho debug is set to true. the app is working on my local machine. but on the server its giving the Whoops error. how can i debug this

mac03733 left a reply on DataTables Warning

in controller

  public function getAllUsers(Request $request)  {

                $columns = array(
                                    0 =>'id',
                                    1 =>'userImg',
                                    2=> 'name',
                                    3=> 'email',
                                    4=> 'profile'

                                );

                $totalData = User::count();

                $totalFiltered = $totalData;

                $limit = $request->input('length');
                $start = $request->input('start');
                $order = $columns[$request->input('order.0.column')];
                $dir = $request->input('order.0.dir');

                if(empty($request->input('search.value')))
                {
                    $Users = User::offset($start)
                                 ->limit($limit)
                                 ->orderBy($order,$dir)
                                 ->get();
                }
                else {
                    $search = $request->input('search.value');

                    $Users =  User::where('id','LIKE',"%{$search}%")
                                    ->orWhere('name', 'LIKE',"%{$search}%")
                                    ->orWhere('email', 'LIKE',"%{$search}%")
                                    ->offset($start)
                                    ->limit($limit)
                                    ->orderBy($order,$dir)
                                    ->get();

                    $totalFiltered = User::where('id','LIKE',"%{$search}%")
                                     ->orWhere('name', 'LIKE',"%{$search}%")
                                     ->orWhere('email', 'LIKE',"%{$search}%")
                                     ->count();
                }

                $data = array();
                if(!empty($Users))
                {
                    foreach ($Users as $User)
                    {
                        $show =  route('admin.viewUser',$User->id);
                        $userImg =  asset('storage/images/avatar5.png');

                        $nestedData['id'] = $User->id;
                        $nestedData['userImg'] = "<img class='img-fluid img-responsive img-circle' style='max-width:50px' src='{$userImg}'/>";
                        $nestedData['name'] = $User->name;
                        $nestedData['email'] = $User->email;
                        $nestedData['profile'] = "<a href='{$show}' class='btn d-inline'><i class='fas fa-eye text-dark'></i></a>";

                        $data[] = $nestedData;

                    }
                }

                $json_data = array(
                            "draw"            => intval($request->input('draw')),
                            "recordsTotal"    => intval($totalData),
                            "recordsFiltered" => intval($totalFiltered),
                            "data"            => $data
                            );

                echo json_encode($json_data);


      }

javascript

  $(document).ready(function () {
      $('#user_table_id').DataTable({
          "processing": true,
          "serverSide": true,
          "ajax":{
                   "url": "{{ route('admin.getUsers') }}",
                   "dataType": "json",
                   "type": "POST",
                   "data":{ _token: "{{csrf_token()}}"}
                 },
          "columns": [
              { "data": "id" },
              { "data": "userImg" },
              { "data": "name" },
              { "data": "email" },
              { "data": "profile" }


          ],
          "columnDefs": [
            { "targets": [1,4], "orderable": false }
          
          ]

      });
  });

mac03733 started a new conversation DataTables Warning

i seem to be getting this alert at random times .the datatable works perfectly thn out of nowhere it gives that alert then goes back to being normal

DataTables warning: table id=user_table_id - Ajax error. For more information about this error, please see http://datatables.net/tn/7

if anyone has ran into this before or knows the possible cause and fix please help.

17 Aug
3 months ago

mac03733 left a reply on Exclude A Column Form Datatable Sorting

@Cronix works like a charm .. thanks a lot

mac03733 started a new conversation Exclude A Column Form Datatable Sorting

hi ..i am using datatables from datatable.net .. is there a way to exclude a column from being sortable. for example a image column. the library seems to give am error if u try to click sort on such columns

mac03733 left a reply on Uncaught TypeError: Cannot Set Property '$' Of Undefined

i replaced

var $  = require( 'jquery' );
var dt = require( 'datatables.net' )();

with -> that fixed it

import $ from 'jquery';
import dt from 'datatables.net';

mac03733 started a new conversation Uncaught TypeError: Cannot Set Property '$' Of Undefined

i am trying to use Datatable from datatable.net these are the steps i followed. i notice this error in my console " Uncaught TypeError: Cannot set property '$' of undefined "

npm install datatables.net    
npm install datatables.net-dt 

then in my app.js

var $  = require( 'jquery' );
var dt = require( 'datatables.net' )();

then in my blade

$(document).ready( function () {

  $('#table_id').DataTable();
} );

for the styling i downloaded th files manually and placed them in my public folder -->if thers a better way please let me knw

  <link href="{{ asset('css/dataTables.bootstrap4.css') }}" rel="stylesheet">
<script src="{{ asset('js/dataTables.bootstrap4.min.js') }}" ></script>

mac03733 left a reply on Best Datatable Plugin For Laravel ?

this is how i installed it

npm install datatables.net    
npm install datatables.net-dt 

then in my app.js

var $  = require( 'jquery' );
var dt = require( 'datatables.net' )();

then in my blade

$(document).ready( function () {

  $('#table_id').DataTable();
} );

this gave me a barley formatted table and the only way i can think of to customize it is by targeting the elements directly .is there an easyier way

mac03733 left a reply on Best Datatable Plugin For Laravel ?

@phpMick i tried that one on a sample project ... but cant seem to get the customization right

mac03733 started a new conversation Best Datatable Plugin For Laravel ?

can anyone recommend a good datatable plugin for laravel, preferably with Server-side processing and easy to implement

16 Aug
3 months ago

mac03733 left a reply on About Application Deployment

there are platforms that help do it for you eg - Forge. but if u prefer to do it yourself on a VPS you can visit this link https://www.youtube.com/watch?v=5Y4STYfvpk4&list=PLwAKR305CRO_WMJAJxGz6UCViQyAjdjgo .its a detailed playlist on how to setup a LEMP stack and deploy your app

14 Aug
3 months ago

mac03733 left a reply on Validating Current Team If User Were To Change Teams In A Different Tab

why not check if the user belongs to the team they are trying to post under " in the the create post method". or am i not getting the question

13 Aug
3 months ago

mac03733 left a reply on Use Named Route And Asset In Controller

@Cruorzy i already used php artisan storage:link .. i was using the code in my blade template and it works ..but now i needed to move it to my controller

mac03733 left a reply on Admin ,Users ---> Separate Table VS Single Table

are there any major drawback i should worry bout with any of them .. and which questions or likely situations would require one or the other approach