mac03733

Experience

1,220

0 Best Reply Awards

  • Member Since 1 Month Ago
  • 0 Lessons Completed
  • 0 Favorites

21st August, 2018

mac03733 left a reply on No Debug Page ( Debug Is True ) • 1 hour ago

.env

APP_DEBUG=true

app.php

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

mac03733 left a reply on No Debug Page ( Debug Is True ) • 1 hour ago

@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 ) • 1 hour ago

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

20th August, 2018

mac03733 left a reply on No Debug Page ( Debug Is True ) • 16 hours ago

@Talinon i already have 775 permission recursively applied to storage

mac03733 started a new conversation No Debug Page ( Debug Is True ) • 18 hours ago

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 • 1 day ago

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 • 1 day ago

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.

17th August, 2018

mac03733 left a reply on Exclude A Column Form Datatable Sorting • 3 days ago

@Cronix works like a charm .. thanks a lot

mac03733 started a new conversation Exclude A Column Form Datatable Sorting • 3 days ago

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 • 3 days ago

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 • 4 days ago

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 ? • 4 days ago

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 ? • 4 days ago

@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 ? • 4 days ago

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

16th August, 2018

mac03733 left a reply on About Application Deployment • 5 days ago

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

14th August, 2018

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

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

13th August, 2018

mac03733 left a reply on Use Named Route And Asset In Controller • 1 week ago

@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 • 1 week ago

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

mac03733 started a new conversation Use Named Route And Asset In Controller • 1 week ago

i am trying to get the image and also set a named route in my controller

  foreach($users as $user){
                  $output .= '
                    <tr>
                      <td >'.$user->id.'</td>
                      <td>
                      <img src="{{ asset("storage/images/avatar5.png") }}" > //here ?? <-------------
                      </td>
                      <td>'.$user->name.'</td>                      
                      <td>
                      <a href="{{route("admin.viewUser",["id"=>'. $user->id .'])}}" class="btn  d-inline"> 
                  
                      </a> //here ?? <-------------
                      </td>
                    </tr>
                  ';
                }

10th August, 2018

mac03733 started a new conversation Admin ,Users ---> Separate Table VS Single Table • 1 week ago

hi guys. i am new to laravel and i know this is probably a matter of preference.

but i am curious which approach is the best

mac03733 left a reply on Relationship With Unknown Foreign Key ( Foreign Key Can Be One Of Two) • 1 week ago

will continue trying to find solve it..thanks for feedback

mac03733 left a reply on Relationship With Unknown Foreign Key ( Foreign Key Can Be One Of Two) • 1 week ago

@cmdobueno and @martinbean somthing to concider on my next project ...THANKS.

being new to laravel and all ..one tutorial says this is best next one says that is best :(

would appreciate some help with my current problem

mac03733 left a reply on Relationship With Unknown Foreign Key ( Foreign Key Can Be One Of Two) • 1 week ago

@martinbean using authorization is not bad.. but if the actors are gonna have different attributes i belive its better to separate them

mac03733 started a new conversation Relationship With Unknown Foreign Key ( Foreign Key Can Be One Of Two) • 1 week ago

hi guys ...i have 3 tables ... 1)users 2)admins 3)messages

use case

->user can message user ->admins and users can message ->admins can message admin

now my question is can anyone advice on how i would set my relationships "considering the foreign key for--> sender and recipient column can change depending on whether its an admin or user model "

so i think i cant do somthing like this

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

because send could also be

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

same goes for recipient

7th August, 2018

mac03733 left a reply on Saving Images To Separate Table • 1 week ago

@tykus after reading ur first solution and the explanation..it made sense ..THANKS

-- ill be using the second solution you gave tho ..

mac03733 left a reply on Saving Images To Separate Table • 1 week ago

@ tykus after looking at ur first answer and reading the explanation ,it makes sense...THANKS

ill give it a try ..even tho i was hoping to stick to one syntax ..becouse iv been using this syntax through out the project ... $post= new Post; and with that solution id have to use DB::

mac03733 left a reply on Saving Images To Separate Table • 1 week ago

i am trying something like this ..

  public function addPost(Request $request)
        {
        
          $post= new Post;
          $post->title = $request->input('title');
          $post->body= $request->input('body');
         
          //i want to add the image to the images table with th post id as a foreign key
    if($request->hasFile('post_images')){
        foreach ($request->post_images as $image) {
            $image = new Image;
            $image->post_id = //-------------????
        }   
    }

       
          $post->save();
          
        

        }

mac03733 left a reply on Saving Images To Separate Table • 1 week ago

@lostdreamer_nl .. i am not trying to migrate the current data.

@tykus i am using eloquent

mac03733 started a new conversation Saving Images To Separate Table • 1 week ago

hi .. iv been saving all my images "image path" in one database column separated by ; ... this is working fine ..

but in the name of good programming am considering saving the image path in its own table and using the Post's primary key as a foreign key assuming am working with posts

but problem is how to get $post->id so i can add it to the $image->post_id as a foreign key as i save the $post

31st July, 2018

mac03733 left a reply on Laravel 5.6 Relationships -- Foreign Key • 3 weeks ago

@tisuchi Thanks a lot ...that explanation is very detailed

mac03733 left a reply on Laravel 5.6 Relationships -- Foreign Key • 3 weeks ago

@tisuchi is there any explanation as to why this is working (i dd not specify any foreign key)

first table ( posts table)

id | title | category_id |

|          |                         |

in th model

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

second table ( category table )

id | name | description |

|             |                         |

in th model

public function posts(){
      return $this->hasMany('post');
    }

mac03733 left a reply on Laravel 5.6 Relationships -- Foreign Key • 3 weeks ago

@tisuchi do i need to specify the foreign key (assuming am using post_id)?

mac03733 started a new conversation Laravel 5.6 Relationships -- Foreign Key • 3 weeks ago

hi guys... am trying to understand laravel relationships.

  1. do i need to foreign keys --> ( i have a categories table and and posts table, am using th belongsTo() and the hasMany() ,it seems to be working perfectly without me specifying any foreign keys ..but this just makes me wounder how its actually doing it and if there are any good/bad practices i should consider in regards to this )

14th July, 2018

mac03733 left a reply on How To Download Database Records As Execl Files In Laravel 5.6 • 1 month ago

@Faizan59 ..unfortunatly that didnt work for me .. thanks for the attempt tho

13th July, 2018

mac03733 started a new conversation How To Download Database Records As Execl Files In Laravel 5.6 • 1 month ago

hi guys, iv been using maatwebsite/excel to download database records as excel files.this workes on my local machine but when i upload it to digital ocean VPS it doesnt download "give a whoops page". after doing some research i ran into a post that mentioned it might not be supported for long.

so can anyone please help with eighter a better solution to download excel files OR suggestions on how i can resolve my problem

I am using a LEMP stack incase this is relevant.

BY the way i am still new to all this :{ hence the possibly novice question

11th July, 2018

mac03733 left a reply on Laravel Log Error Using LEMP Stack And Php7.1 • 1 month ago

@lostdreamer_nl where was the ?? used... and is there a way i can work around that if thats the problem

mac03733 left a reply on Hosting A Laravel 5.6 App On A VPS Like Digital Ocean "LEMP" • 1 month ago

this solved my errors

sudo apt-add-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.1-cli php7.1-fpm php7.1-mbstring php7.1-mysql php7.1-mcrypt php7.1-curl

sudo apt-get install nginx

i update my php version hopefully it wont lead to any problems i havnt noticed yet.but so far all good

mac03733 started a new conversation Laravel Log Error Using LEMP Stack And Php7.1 • 1 month ago

hi i am trying to upload my laravel 5.6 app to a VPS.am using the LEMP stack ,php 7.1 and this is the error i am getting in my laravel.log after running the following command

--> nano storage/logs/laravel.log


[2018-07-11 11:57:26] production.ERROR: syntax error, unexpected '?', 
expecting variable (T_VARIABLE) {"exception":"[object] 
(Symfony\Component\Debug\Exception\Fat$[stacktrace]
#0 /var/www/laravel/vendor/composer/ClassLoader.php(322): 
Composer\Autoload\includeFile('/var/www/larave...')
#1 [internal function]: Composer\Autoload\ClassLoader- 
>loadClass('Symfony\\Compone...')

incase this is relevant the i suspect my problem is in the file below

sudo nano sites-available/default

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
#       # With php7.0-cgi alone:
#       fastcgi_pass 127.0.0.1:9000;
#       # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}

sorry incase its a silly question ..i am very new to this

mac03733 started a new conversation Hosting A Laravel 5.6 App On A VPS Like Digital Ocean "LEMP" • 1 month ago

i am trying to host on a VPS for the frist time .and after a long search i came across a tutorial that was helpful. problem is it was based on laravel 5.2 and the php requirement was 7.0

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

i could use some help if anyone has a better alternative for hosting laravel 5.6 app OR the modification i could make to allow the current solution to work with my current enviroment

my ERRORs

  Problem 1
    - This package requires php ^7.1.3 but your PHP version (7.0.30) does not satisfy that requirement.
  Problem 2
    - Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
    - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
  Problem 18
    - laravel/framework v5.6.24 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
    - maatwebsite/excel 2.1.28 requires illuminate/cache 5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.* -> satisfiable by laravel/framework[v5.6.24].
    - Installation request for maatwebsite/excel 2.1.28 -> satisfiable by maatwebsite/excel[2.1.28].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mbstring.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini

9th July, 2018

mac03733 left a reply on Redirect User To Same Page After Making Them Login ( Laravel 5.6 ) • 1 month ago

@Snapey ---sorry what i meant to say is -> it logs in but remains on the login page

6th July, 2018

mac03733 left a reply on Redirect User To Same Page After Making Them Login ( Laravel 5.6 ) • 1 month ago

@Snapey when i make the changes above it refuses to even login.

5th July, 2018

mac03733 left a reply on Redirect User To Same Page After Making Them Login ( Laravel 5.6 ) • 1 month ago

@wilburpowery that is not what i am looking for.. what u explained is working fine.

what i am trying to do is ---from a page EVERYONE can access if there is an element that requires u to be logged in ,for example a comment button it should take u to login then back to same page..

i hope i didnt explaned poorly

mac03733 started a new conversation Redirect User To Same Page After Making Them Login ( Laravel 5.6 ) • 1 month ago

After successful login, the user should be redirected to the page he came from, let's say he's been browsing a post and wants to log in so he can leave a comment, so he should be redirected to the post he was browsing.

<a class="btn" href="{{ route('login') }}" > Login to Comment</a>

30th June, 2018

mac03733 left a reply on Vue Not Updating Binded Value • 1 month ago

example please

mac03733 left a reply on Vue Not Updating Binded Value • 1 month ago

<input class="btn" id="bidInput" type="number" name="new_bid" step="500" value="" v-model="NewBidMadeValue">
function bidUp() {
    document.getElementById("bidInput").stepUp();
  }
  function bidDown() {
    document.getElementById("bidInput").stepDown();
  }

the value in the field increments and decrements..but the binded value is not changing

mac03733 started a new conversation Vue Not Updating Binded Value • 1 month ago

vue not updating binded value when i use th .stepUp and .stepDown function to increment an html number input field

28th June, 2018

mac03733 left a reply on Laravel Echo --- >Cannot Read Property 'channel' Of Undefined • 1 month ago

my problem was that my script tag had the defer attribute .



    <script src="{{ asset('js/app.js') }}" defer></script>

removing it fix the problem

mac03733 started a new conversation Laravel Echo --- >Cannot Read Property 'channel' Of Undefined • 1 month ago

iv been trying to solve this since morning...i keep get this error..

vue.js:1743 TypeError: Cannot read property 'channel' of undefined
  

i am trying to listen on a channel using this code

  listen(){
        window.Echo.channel('tmp-chanel')
              .listen('NewBidMade',(auction_item) => {
                console.log('-------wakanda-------');
                // this.item = auction_item;
              });
        },

any ideas or possible solutions are welcome

27th June, 2018

mac03733 left a reply on Axios Put Request • 1 month ago

turns out my error was in my controller not the axios code ... thanks for the feedback buys

Edit Your Profile
Update

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