Jump to content

osherdo

Members
  • Content Count

    41
  • Joined

  • Last visited

Community Reputation

0 Neutral

About osherdo

  • Rank
    Member
  1. @Jackues1 ok I get you. Well I think the accurate question I wanted to ask for this specific thread,regardless of Laravel framework - How can I reuse a php method (suppose it contains the logic for authenticating a user) in a function?
  2. @Jacques1 thanks for that. So I understood the quoted part from your reply, and I think I may have misunderstood you.
  3. @OrpheanBeholderScryDoubt I think the second solution will be better. I still don't get why I will need to call the method in the constructor as well. @Dark Administrator this is what I am trying to figure
  4. I am using Laravel framework. I want to authenticate a user on all functions available in my code. I did not understood the constructor method quite right, and the docs were hard to follow as well. Assuming I have this code: public function __construct() { // Constructor for checking user's auth after a while. $this->middleware('auth'); if (!Auth::check()) { return redirect('auth/login'); } function something() { // How do I call it to work inside this function? } Thanks for helping.
  5. @OrpheanBeholderScryDoubt thanks for the suggestion and reference. Good to know about it.
  6. unfortunately using this: [] returns an error: syntax error, unexpected '[', expecting '('
  7. It seems that only this works: public function authorize($ability, $arguments = array()) because using the other one, or using them both as an arguments returns this error: (I am using Laravel, and it returns this) Declaration of App\Http\Controllers\DropzoneController::authorize() should be compatible with App\Http\Controllers\Controller::authorize($ability, $arguments = Array) I am now getting an error of Laravel, so that'll do for now. much thanks!
  8. I have this code: class DropzoneController extends Controller { public function __construct() { $this->middleware('auth'); if (!Auth::check()) { return redirect('auth/login'); } $this->user = Auth::user(); } public function index() { return view('dropzone_demo'); } public function uploadFiles() { $message="Profile Image Created"; $input = Input::all(); $rules = array( 'file' => 'image|max:3000', ); $validation = Validator::make($input, $rules); if ($validation->fails()) { return Response::make($validation
  9. ignore it, I have mistakenly tried to insert to the same id that already existed, and it thrown an error.
  10. I am trying to insert multiple rows to a column in mysql like this: INSERT INTO `sportsapp`.`exercises` (`id`, `image_path`, `name`, `category`) VALUES ('3', 'exercises/biceps/barbell_curls_lying_against_an_incline.jpg', 'Barbell Curls Lying Against An Incline', 'Biceps'), ('4','exercises/biceps/cable_hammer_curls_-_rope_attachment','Cable hammer Curls - Rope Attachment','Biceps'); I am getting an error in return: I tried to google and understand what's the reason for it, but I dont get it. I do have already a primary key, and I don't know why it generates another primary key, Cou
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.